[libunwind] [libunwind] Use -nostdlib++ when linking libunwind (PR #75646)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 15 11:45:01 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libunwind
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
We shouldn't need to link against libc++ or libc++abi when building libunwind, since that would otherwise be a circular dependency.
---
Full diff: https://github.com/llvm/llvm-project/pull/75646.diff
1 Files Affected:
- (modified) libunwind/src/CMakeLists.txt (+10-9)
``````````diff
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index abb019b88ebabd..c0e60f29a3db25 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -66,20 +66,21 @@ 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)
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/75646
More information about the cfe-commits
mailing list