[compiler-rt] [compiler-rt][test] Apply CFLAGS from sanitizer_common to all tests (PR #120798)

Aaron Puchert via llvm-commits llvm-commits at lists.llvm.org
Tue May 6 15:12:25 PDT 2025


================
@@ -307,6 +307,14 @@ macro(get_test_cc_for_arch arch cc_out cflags_out)
     if(APPLE)
       list(APPEND ${cflags_out} ${DARWIN_osx_CFLAGS})
     endif()
+    if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+      # ARM on Linux might use the slow unwinder as default and the unwind table
+      # is required to get a complete stacktrace.
+      list(APPEND ${cflags_out} -funwind-tables)
----------------
aaronpuchert wrote:

We do it right in [compiler-rt/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/compiler-rt/CMakeLists.txt):
```cmake
# We support running instrumented tests when we're not cross-compiling
# and target a UNIX-like system or Windows.
# We can run tests on Android even when we are cross-compiling.
if((NOT "${CMAKE_CROSSCOMPILING}" AND (UNIX OR WIN32))
   OR ANDROID OR COMPILER_RT_EMULATOR)
  option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON)
else()
  option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" OFF)
endif()
```

https://github.com/llvm/llvm-project/pull/120798


More information about the llvm-commits mailing list