File tree 2 files changed +18
-0
lines changed 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -506,6 +506,11 @@ list(APPEND COMPILER_RT_COMMON_LINK_FLAGS ${stdlib_flag})
506
506
507
507
macro (append_libcxx_libs var)
508
508
if (${var} _INTREE)
509
+ # If we're linking directly against the libunwind that we're building
510
+ # in the same invocation, don't try to link in the toolchain's
511
+ # default libunwind (which may be missing still).
512
+ append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SANITIZER_COMMON_LINK_FLAGS)
513
+
509
514
if (SANITIZER_USE_STATIC_LLVM_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
510
515
list (APPEND ${var} _LIBRARIES unwind_static)
511
516
elseif (TARGET unwind_shared OR HAVE_LIBUNWIND)
Original file line number Diff line number Diff line change @@ -4,9 +4,22 @@ include(CheckCCompilerFlag)
4
4
include (CheckCXXCompilerFlag)
5
5
include (CheckIncludeFiles)
6
6
include (CheckLibraryExists)
7
+ include (LLVMCheckCompilerLinkerFlag)
7
8
include (CheckSymbolExists)
8
9
include (TestBigEndian)
9
10
11
+ # The compiler driver may be implicitly trying to link against libunwind.
12
+ # This is normally ok (libcxx relies on an unwinder), but if libunwind is
13
+ # built in the same cmake invocation as compiler-rt and we're using the
14
+ # in tree version of runtimes, we'd be linking against the just-built
15
+ # libunwind (and the compiler implicit -lunwind wouldn't succeed as the newly
16
+ # built libunwind isn't installed yet). For those cases, it'd be good to
17
+ # link with --uwnindlib=none. Check if that option works.
18
+ llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_NONE_FLAG)
19
+ if (CXX_SUPPORTS_UNWINDLIB_NONE_FLAG)
20
+ set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none" )
21
+ endif ()
22
+
10
23
check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
11
24
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
12
25
include (HandleCompilerRT)
You can’t perform that action at this time.
0 commit comments