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

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 10:03:53 PDT 2025


https://github.com/gulfemsavrun created https://github.com/llvm/llvm-project/pull/152177

Reverts llvm/llvm-project#120798 because it caused an AddressSanitizer test breakage in global-overflow-bfd.cpp:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8707434189452310849/overview

>From f5aae27909984a0747dce08e7031f843f6693103 Mon Sep 17 00:00:00 2001
From: gulfemsavrun <gulfem at google.com>
Date: Tue, 5 Aug 2025 10:02:21 -0700
Subject: [PATCH] =?UTF-8?q?Revert=20"[compiler-rt][test]=20Apply=20CFLAGS?=
 =?UTF-8?q?=20from=20sanitizer=5Fcommon=20to=20all=20tests=20(=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit b757bc8b13b1088e2f2b1b98aa33ebb16334b59d.
---
 compiler-rt/cmake/config-ix.cmake                |  8 --------
 compiler-rt/test/sanitizer_common/CMakeLists.txt | 11 +++++++++++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 212a09f55b32b..e3310b1ff0e2c 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -309,14 +309,6 @@ macro(get_test_cc_for_arch arch cc_out cflags_out)
     endif()
     string(REPLACE ";" " " ${cflags_out} "${${cflags_out}}")
   endif()
-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID)
-    # ARM on Linux might use the slow unwinder as default and the unwind table
-    # is required to get a complete stacktrace.
-    string(APPEND ${cflags_out} " -funwind-tables")
-    if(CMAKE_SYSROOT)
-      string(APPEND ${cflags_out} " --sysroot=${CMAKE_SYSROOT}")
-    endif()
-  endif()
 endmacro()
 
 # Returns CFLAGS that should be used to run tests for the
diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt
index b044b9c6c3e08..615666676f57a 100644
--- a/compiler-rt/test/sanitizer_common/CMakeLists.txt
+++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt
@@ -73,6 +73,17 @@ foreach(tool ${SUPPORTED_TOOLS})
     get_test_cc_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CC SANITIZER_COMMON_TEST_TARGET_CFLAGS)
     set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
 
+    # ARM on Linux might use the slow unwinder as default and the unwind table is
+    # required to get a complete stacktrace.
+    if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT ANDROID)
+      list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS -funwind-tables)
+      if(CMAKE_SYSROOT)
+        list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS "--sysroot=${CMAKE_SYSROOT}")
+      endif()
+      string(REPLACE ";" " " SANITIZER_COMMON_TEST_TARGET_CFLAGS
+                             "${SANITIZER_COMMON_TEST_TARGET_CFLAGS}")
+    endif()
+
     configure_lit_site_cfg(
       ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
       ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)



More information about the llvm-commits mailing list