[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:01:32 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:

The old code applied these flags for non-Android Linux. Here we're on non-Android Linux, except where `${arch} MATCHES "arm|aarch64|riscv32|riscv64"`. I don't know why "this is only true if we are cross-compiling" as the comment says. There are [actual CMake variables](https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING.html) to detect cross-compiles, and I don't see why you couldn't build all of LLVM on these arches directly. So I think this might be wrong, but I'm also afraid to fix it.

The issue was reported on x86, but I guess it could also appear on other architectures if they're built with a sysroot and no cross toolchain.

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


More information about the llvm-commits mailing list