[libcxx-commits] [libcxxabi] [libcxxabi] Always link against libzircon for Fuchsia targets (PR #115910)

Paul Kirth via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 9 09:18:16 PST 2024


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

>From 70828dc662560c9788bddb3311e255d964efa217 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Tue, 12 Nov 2024 09:39:24 -0800
Subject: [PATCH 1/3] =?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
---
 libcxxabi/src/CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 84fe2784bec5ca..5a384c5345d755 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -75,6 +75,10 @@ if (NOT APPLE) # On Apple platforms, we always use -nostdlib++ so we don't need
   add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
 endif()
 
+if (FUCHSIA)
+    add_library_flags(zircon)
+endif()
+
 if (NOT LIBCXXABI_USE_COMPILER_RT)
   add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
 endif()

>From 498c1612b284db66305b6dc572cbe5affd10e622 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Thu, 14 Nov 2024 09:43:13 -0800
Subject: [PATCH 2/3] Actually use --as-needed in the correct patch

Created using spr 1.3.4
---
 libcxxabi/src/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 5a384c5345d755..ae824a0afaada1 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -76,7 +76,7 @@ if (NOT APPLE) # On Apple platforms, we always use -nostdlib++ so we don't need
 endif()
 
 if (FUCHSIA)
-    add_library_flags(zircon)
+    add_link_flags("-Wl,--push-state,--as-needed,-lzircon,--pop-state")
 endif()
 
 if (NOT LIBCXXABI_USE_COMPILER_RT)

>From 6feaf3b7d296850394c2c32424008699e411939a Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 18 Nov 2024 13:36:13 -0800
Subject: [PATCH 3/3] Add TODO for CMake feature in 3.24

Created using spr 1.3.6-beta.1
---
 libcxxabi/src/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index ae824a0afaada1..43df9f95c3ec1d 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -76,6 +76,8 @@ if (NOT APPLE) # On Apple platforms, we always use -nostdlib++ so we don't need
 endif()
 
 if (FUCHSIA)
+    # TODO use CMAKE_LINK_LIBRARY_USING_FEATURE once our minimum CMake is at least 3.24
+    # https://cmake.org/cmake/help/latest/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.html 
     add_link_flags("-Wl,--push-state,--as-needed,-lzircon,--pop-state")
 endif()
 



More information about the libcxx-commits mailing list