[compiler-rt] [Fuchsia][cmake] Avoid referencing cxx_shared in compiler-rt (PR #112257)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 14:11:57 PDT 2024


https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/112257

>From 1638581f72759eb622a01bd4659189c2eb308809 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 14 Oct 2024 20:12:52 +0000
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/CMakeLists.txt             | 6 +++---
 compiler-rt/test/fuzzer/CMakeLists.txt | 7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index deb6994f481854..98c28556755525 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -616,7 +616,7 @@ if(COMPILER_RT_USE_LLVM_UNWINDER)
   if (COMPILER_RT_ENABLE_STATIC_UNWINDER)
     list(APPEND COMPILER_RT_UNWINDER_LINK_LIBS "$<TARGET_LINKER_FILE:unwind_static>")
   else()
-    list(APPEND COMPILER_RT_UNWINDER_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:unwind_shared>,unwind_shared,unwind_static>>")
+    list(APPEND COMPILER_RT_UNWINDER_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<BOOL:${LIBUNWIND_ENABLE_SHARED}>,unwind_shared,unwind_static>>")
   endif()
 endif()
 
@@ -629,7 +629,7 @@ if (COMPILER_RT_CXX_LIBRARY STREQUAL "libcxx")
   if (COMPILER_RT_STATIC_CXX_LIBRARY)
     set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:cxx_static>")
   else()
-    set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:cxx_shared>,cxx_shared,cxx_static>>")
+    set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<BOOL:${LIBCXX_ENABLE_SHARED}>,cxx_shared,cxx_static>>")
   endif()
 elseif (COMPILER_RT_CXX_LIBRARY STREQUAL "none")
   # We aren't using any C++ standard library so avoid including the default one.
@@ -671,7 +671,7 @@ if (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libc++")
     if (SANITIZER_USE_STATIC_TEST_CXX)
       list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:cxx_static>")
     else()
-      list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:cxx_shared>,cxx_shared,cxx_static>>")
+      list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:$<IF:$<BOOL:${LIBCXX_ENABLE_SHARED}>,cxx_shared,cxx_static>>")
     endif()
     # We are using the in tree libc++ so avoid including the default one.
     append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ COMPILER_RT_UNITTEST_CFLAGS)
diff --git a/compiler-rt/test/fuzzer/CMakeLists.txt b/compiler-rt/test/fuzzer/CMakeLists.txt
index b19f52e591fc0f..982225f294d238 100644
--- a/compiler-rt/test/fuzzer/CMakeLists.txt
+++ b/compiler-rt/test/fuzzer/CMakeLists.txt
@@ -73,11 +73,10 @@ endmacro()
 
 test_fuzzer("default")
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
-  if(TARGET cxx_shared)
-    test_fuzzer("libc++" DEPS cxx_shared)
-  endif()
-  if(TARGET cxx_static)
+  if(LIBCXX_ENABLE_STATIC)
     test_fuzzer("static-libc++" DEPS cxx_static)
+  elseif(LIBCXX_ENABLE_SHARED)
+    test_fuzzer("libc++" DEPS cxx_shared)
   endif()
 endif()
 

>From e9897d95bbfc4449a077d68ee63d0b977f4c0f3d Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 14 Oct 2024 14:06:40 -0700
Subject: [PATCH 2/4] Update compiler-rt/test/fuzzer/CMakeLists.txt

Co-authored-by: Petr Hosek <phosek at google.com>
---
 compiler-rt/test/fuzzer/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/test/fuzzer/CMakeLists.txt b/compiler-rt/test/fuzzer/CMakeLists.txt
index 982225f294d238..2ee0aa8f492e74 100644
--- a/compiler-rt/test/fuzzer/CMakeLists.txt
+++ b/compiler-rt/test/fuzzer/CMakeLists.txt
@@ -75,7 +75,7 @@ test_fuzzer("default")
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
   if(LIBCXX_ENABLE_STATIC)
     test_fuzzer("static-libc++" DEPS cxx_static)
-  elseif(LIBCXX_ENABLE_SHARED)
+  if(LIBCXX_ENABLE_SHARED)
     test_fuzzer("libc++" DEPS cxx_shared)
   endif()
 endif()

>From 8b700a73455b9a332f25a15f78f0a47418f83fcf Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 14 Oct 2024 21:09:18 +0000
Subject: [PATCH 3/4] Allow both static and shared

Created using spr 1.3.4
---
 compiler-rt/test/fuzzer/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/compiler-rt/test/fuzzer/CMakeLists.txt b/compiler-rt/test/fuzzer/CMakeLists.txt
index 2ee0aa8f492e74..d031cc01e858db 100644
--- a/compiler-rt/test/fuzzer/CMakeLists.txt
+++ b/compiler-rt/test/fuzzer/CMakeLists.txt
@@ -75,6 +75,7 @@ test_fuzzer("default")
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
   if(LIBCXX_ENABLE_STATIC)
     test_fuzzer("static-libc++" DEPS cxx_static)
+  endif()
   if(LIBCXX_ENABLE_SHARED)
     test_fuzzer("libc++" DEPS cxx_shared)
   endif()

>From a67fba5472fafaceb6b6741f8adbbfbe3523d322 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 14 Oct 2024 21:11:42 +0000
Subject: [PATCH 4/4] Reorder statements to minimize diff

Created using spr 1.3.4
---
 compiler-rt/test/fuzzer/CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/test/fuzzer/CMakeLists.txt b/compiler-rt/test/fuzzer/CMakeLists.txt
index d031cc01e858db..51021e2dc2d995 100644
--- a/compiler-rt/test/fuzzer/CMakeLists.txt
+++ b/compiler-rt/test/fuzzer/CMakeLists.txt
@@ -73,12 +73,12 @@ endmacro()
 
 test_fuzzer("default")
 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
-  if(LIBCXX_ENABLE_STATIC)
-    test_fuzzer("static-libc++" DEPS cxx_static)
-  endif()
   if(LIBCXX_ENABLE_SHARED)
     test_fuzzer("libc++" DEPS cxx_shared)
   endif()
+  if(LIBCXX_ENABLE_STATIC)
+    test_fuzzer("static-libc++" DEPS cxx_static)
+  endif()
 endif()
 
 if(LIBFUZZER_TESTSUITES)



More information about the llvm-commits mailing list