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

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 9 09:19:54 PST 2024


Author: Paul Kirth
Date: 2024-12-09T09:19:51-08:00
New Revision: fac9fcd55245479d040dde3f5e9f4e169c30a0ec

URL: https://github.com/llvm/llvm-project/commit/fac9fcd55245479d040dde3f5e9f4e169c30a0ec
DIFF: https://github.com/llvm/llvm-project/commit/fac9fcd55245479d040dde3f5e9f4e169c30a0ec.diff

LOG: [libcxxabi] Always link against libzircon for Fuchsia targets (#115910)

When using LTO, the deplibs mechanism is insufficient to ensure that
libzircon is always brought into the link prior to LTO code generation.
The general problem is discussed in depth in
https://github.com/llvm/llvm-project/issues/56070

To work around this, we can just provide libzircon as a link input.

Added: 
    

Modified: 
    libcxxabi/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 84fe2784bec5ca..21dda44e09976a 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -75,6 +75,12 @@ 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)
+    # 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()
+
 if (NOT LIBCXXABI_USE_COMPILER_RT)
   add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
 endif()


        


More information about the libcxx-commits mailing list