[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.
This commit is contained in:
Paul Kirth
2024-12-09 09:19:51 -08:00
committed by GitHub
parent 4646cabf01
commit fac9fcd552

View File

@@ -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()