mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 23:51:56 +00:00
Reapply [compiler-rt] Check for and use -lunwind when linking with -nodefaultlibs (#66584)
If libc++ is available and should be used as the ubsan C++ ABI library, the check for libc++ might fail if libc++ is a static library, as the -nodefaultlibs flag inhibits a potential compiler default -lunwind. Just like the -nodefaultlibs configuration tests for and manually adds a bunch of compiler default libraries, look for -lunwind too. This is a reland of #65912.
This commit is contained in:
parent
26bb22b0c8
commit
7c5e4e5fa3
@ -63,6 +63,16 @@ if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
moldname mingwex msvcrt)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
|
||||
endif()
|
||||
if (NOT TARGET unwind)
|
||||
# Don't check for a library named unwind, if there's a target with that name within
|
||||
# the same build.
|
||||
check_library_exists(unwind _Unwind_GetRegionStart "" COMPILER_RT_HAS_LIBUNWIND)
|
||||
if (COMPILER_RT_HAS_LIBUNWIND)
|
||||
# If we're omitting default libraries, we might need to manually link in libunwind.
|
||||
# This can affect whether we detect a statically linked libc++ correctly.
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES unwind)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# CodeGen options.
|
||||
|
Loading…
Reference in New Issue
Block a user