Skip to content

Commit fac9fcd

Browse files
authored
[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 #56070 To work around this, we can just provide libzircon as a link input.
1 parent 4646cab commit fac9fcd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libcxxabi/src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ if (NOT APPLE) # On Apple platforms, we always use -nostdlib++ so we don't need
7575
add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
7676
endif()
7777

78+
if (FUCHSIA)
79+
# TODO: Use CMAKE_LINK_LIBRARY_USING_FEATURE once our minimum CMake is at least 3.24
80+
# https://cmake.org/cmake/help/latest/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.html
81+
add_link_flags("-Wl,--push-state,--as-needed,-lzircon,--pop-state")
82+
endif()
83+
7884
if (NOT LIBCXXABI_USE_COMPILER_RT)
7985
add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)
8086
endif()

0 commit comments

Comments
 (0)