[compiler-rt] [compiler-rt] Don't detect a versioned clang test compiler as GCC (PR #117812)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 26 16:02:25 PST 2024
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/117812
I was trying to build compiler-rt with /usr/bin/clang-17 and the testsuite
failed due to the code in lit.common.cfg.py:
```
# GCC-ASan uses dynamic runtime by default (since config.bits is not set).
if config.compiler_id == "GNU":
gcc_dir = os.path.dirname(config.clang)
libasan_dir = os.path.join(gcc_dir, "..", "lib" + config.bits)
push_dynamic_library_lookup_path(config, libasan_dir)
```
Fix this in two ways: First, if the test compiler matches the library
compiler, set COMPILER_RT_TEST_COMPILER_ID to CMAKE_C_COMPILER_ID. Second,
relax the regex detecting clang to allow any kind of suffix.
>From 1ba6fd76faceba73b7f4b3db0c787af972465369 Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Tue, 26 Nov 2024 16:02:04 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6-beta.1
---
compiler-rt/cmake/base-config-ix.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index 286a622a4b5202..406387b64f5b70 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -77,9 +77,9 @@ else()
set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing")
endif()
-if("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[+]*$")
- set(COMPILER_RT_TEST_COMPILER_ID Clang)
-elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang.*.exe$")
+if ("${COMPILER_RT_TEST_COMPILER}" STREQUAL ${CMAKE_C_COMPILER})
+ set(COMPILER_RT_TEST_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
+elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[^/]*$")
set(COMPILER_RT_TEST_COMPILER_ID Clang)
elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "cl.exe$")
set(COMPILER_RT_TEST_COMPILER_ID MSVC)
More information about the llvm-commits
mailing list