aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2023-12-19 09:05:32 -0500
committerGitHub <noreply@github.com>2023-12-19 09:05:32 -0500
commitab41ea4be364dcac32d0c4ec990735c8adb279c8 (patch)
tree530d529bd0879398f4d27ce4ba113f610f190e54
parente9af57dfea1637a3872052b317c9fe6c71b8d290 (diff)
downloadllvm-ab41ea4be364dcac32d0c4ec990735c8adb279c8.zip
llvm-ab41ea4be364dcac32d0c4ec990735c8adb279c8.tar.gz
llvm-ab41ea4be364dcac32d0c4ec990735c8adb279c8.tar.bz2
[libunwind] Use -nostdlib++ when linking libunwind (#75646)
We shouldn't need to link against libc++ or libc++abi when building libunwind, since that would otherwise be a circular dependency.
-rw-r--r--libunwind/src/CMakeLists.txt22
1 files changed, 13 insertions, 9 deletions
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index abb019b..5708242 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -66,20 +66,24 @@ set(LIBUNWIND_SOURCES
${LIBUNWIND_ASM_SOURCES})
# Generate library list.
-if (LIBUNWIND_USE_COMPILER_RT)
- add_library_flags("${LIBUNWIND_BUILTINS_LIBRARY}")
+if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
+ add_link_flags_if_supported(-nostdlib++)
else()
- add_library_flags_if(LIBUNWIND_HAS_GCC_S_LIB gcc_s)
- add_library_flags_if(LIBUNWIND_HAS_GCC_LIB gcc)
-endif()
-if (NOT APPLE) # On Apple platforms, we don't need to link explicitly against system libraries
+ if (LIBUNWIND_USE_COMPILER_RT)
+ add_library_flags("${LIBUNWIND_BUILTINS_LIBRARY}")
+ else()
+ add_library_flags_if(LIBUNWIND_HAS_GCC_S_LIB gcc_s)
+ add_library_flags_if(LIBUNWIND_HAS_GCC_LIB gcc)
+ endif()
add_library_flags_if(LIBUNWIND_HAS_C_LIB c)
+endif()
+
+if (NOT APPLE)
add_library_flags_if(LIBUNWIND_HAS_DL_LIB dl)
+endif()
- if (LIBUNWIND_ENABLE_THREADS)
+if (LIBUNWIND_ENABLE_THREADS AND NOT APPLE)
add_library_flags_if(LIBUNWIND_HAS_PTHREAD_LIB pthread)
- add_compile_flags_if(LIBUNWIND_WEAK_PTHREAD_LIB -DLIBUNWIND_USE_WEAK_PTHREAD=1)
- endif()
endif()
if (LIBUNWIND_ENABLE_THREADS)