Skip to content

Commit 288b004

Browse files
committed
[compiler-rt][test] Apply CFLAGS from sanitizer_common to all tests
Sanitizer-specific tests don't use the sanitizer_common flags, but the issues they address probably also apply to the individual sanitizers. This was observed in llvm#119071: moving a test from sanitizer_common to msan broke it in builds with CMAKE_SYSROOT set, because the --sysroot argument was no longer applied to the test.
1 parent bae383b commit 288b004

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

compiler-rt/cmake/config-ix.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ macro(get_test_cc_for_arch arch cc_out cflags_out)
307307
if(APPLE)
308308
list(APPEND ${cflags_out} ${DARWIN_osx_CFLAGS})
309309
endif()
310+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
311+
# ARM on Linux might use the slow unwinder as default and the unwind table
312+
# is required to get a complete stacktrace.
313+
list(APPEND ${cflags_out} -funwind-tables)
314+
if(CMAKE_SYSROOT)
315+
list(APPEND ${cflags_out} "--sysroot=${CMAKE_SYSROOT}")
316+
endif()
317+
endif()
310318
string(REPLACE ";" " " ${cflags_out} "${${cflags_out}}")
311319
endif()
312320
endmacro()

compiler-rt/test/sanitizer_common/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,6 @@ foreach(tool ${SUPPORTED_TOOLS})
7373
get_test_cc_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CC SANITIZER_COMMON_TEST_TARGET_CFLAGS)
7474
set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
7575

76-
# ARM on Linux might use the slow unwinder as default and the unwind table is
77-
# required to get a complete stacktrace.
78-
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT ANDROID)
79-
list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS -funwind-tables)
80-
if(CMAKE_SYSROOT)
81-
list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS "--sysroot=${CMAKE_SYSROOT}")
82-
endif()
83-
string(REPLACE ";" " " SANITIZER_COMMON_TEST_TARGET_CFLAGS
84-
"${SANITIZER_COMMON_TEST_TARGET_CFLAGS}")
85-
endif()
86-
8776
configure_lit_site_cfg(
8877
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
8978
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)

0 commit comments

Comments
 (0)