Skip to content

Commit b515d9e

Browse files
authored
[hwasan][aarch64] Fix missing DT_AARCH64_BTI_PLT flag (#95796)
When building hwasan on aarch64, the DT_AARCH64_BTI_PLT flag is missing from libclang_rt.hwasan.so because some object files without DT_AARCH64_BTI_PLT are linked in the final DSO. These files are specific to riscv64 and x86_64, ending up with no aarch64 code in them. Avoid building and linking architecture-specific files unless the architecture is listed in HWASAN_SUPPORTED_ARCH.
1 parent 7d2c2af commit b515d9e

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

compiler-rt/lib/hwasan/CMakeLists.txt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,28 @@ set(HWASAN_RTL_SOURCES
1515
hwasan_memintrinsics.cpp
1616
hwasan_poisoning.cpp
1717
hwasan_report.cpp
18-
hwasan_setjmp_aarch64.S
19-
hwasan_setjmp_riscv64.S
20-
hwasan_setjmp_x86_64.S
21-
hwasan_tag_mismatch_aarch64.S
22-
hwasan_tag_mismatch_riscv64.S
2318
hwasan_thread.cpp
2419
hwasan_thread_list.cpp
2520
hwasan_type_test.cpp
2621
)
2722

23+
foreach(arch ${HWASAN_SUPPORTED_ARCH})
24+
if(${arch} MATCHES "aarch64")
25+
list(APPEND HWASAN_RTL_SOURCES
26+
hwasan_setjmp_aarch64.S
27+
hwasan_tag_mismatch_aarch64.S)
28+
endif()
29+
if(${arch} MATCHES "riscv64")
30+
list(APPEND HWASAN_RTL_SOURCES
31+
hwasan_setjmp_riscv64.S
32+
hwasan_tag_mismatch_riscv64.S)
33+
endif()
34+
if(${arch} MATCHES "x86_64")
35+
list(APPEND HWASAN_RTL_SOURCES
36+
hwasan_setjmp_x86_64.S)
37+
endif()
38+
endforeach()
39+
2840
set(HWASAN_RTL_CXX_SOURCES
2941
hwasan_new_delete.cpp
3042
)

0 commit comments

Comments
 (0)