Skip to content

Commit 928bc08

Browse files
committedOct 4, 2017
[sanitizer] Move cxx-abi library earlier in link flags.
Summary: This change moves cxx-abi library in asan/ubsan/dd link command line ahead of other libraries, such as pthread/rt/dl/c/gcc. Given that cxx-abi may be the full libstdc++/libc++, it makes sense for it to be ahead of libc and libgcc, at least. The real motivation is Android, where in the arm32 NDK toolchain libstdc++.a is actually a linker script that tries to sneak LLVM's libunwind ahead of libgcc's. Wrong library order breaks unwinding. Reviewers: srhines, danalbert Subscribers: aemerson, kubamracek, mgorny, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D38520 llvm-svn: 314948
1 parent 6efa277 commit 928bc08

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed
 

‎compiler-rt/lib/asan/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@ append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
6767
-ftls-model=initial-exec ASAN_DYNAMIC_CFLAGS)
6868
append_list_if(MSVC /DEBUG ASAN_DYNAMIC_LINK_FLAGS)
6969

70-
set(ASAN_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
70+
set(ASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY} ${SANITIZER_COMMON_LINK_LIBS})
7171

7272
append_list_if(COMPILER_RT_HAS_LIBDL dl ASAN_DYNAMIC_LIBS)
7373
append_list_if(COMPILER_RT_HAS_LIBRT rt ASAN_DYNAMIC_LIBS)
7474
append_list_if(COMPILER_RT_HAS_LIBM m ASAN_DYNAMIC_LIBS)
7575
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread ASAN_DYNAMIC_LIBS)
7676
append_list_if(COMPILER_RT_HAS_LIBLOG log ASAN_DYNAMIC_LIBS)
7777

78-
list(APPEND ASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
79-
8078
# Compile ASan sources into an object library.
8179

8280
add_compiler_rt_object_libraries(RTAsan_dynamic

‎compiler-rt/lib/tsan/dd/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ set(DD_SOURCES
1010
dd_interceptors.cc
1111
)
1212

13-
set(DD_LINKLIBS ${SANITIZER_COMMON_LINK_LIBS})
13+
set(DD_LINKLIBS ${SANITIZER_CXX_ABI_LIBRARY} ${SANITIZER_COMMON_LINK_LIBS})
1414

1515
append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS)
1616
append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS)
1717
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS)
1818

19-
list(APPEND DD_LINKLIBS ${SANITIZER_CXX_ABI_LIBRARY})
20-
2119
add_custom_target(dd)
2220
# Deadlock detector is currently supported on 64-bit Linux only.
2321
if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)

‎compiler-rt/lib/ubsan/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CFLAGS})
3535
append_rtti_flag(ON UBSAN_CXXFLAGS)
3636
append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS)
3737

38-
set(UBSAN_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
38+
set(UBSAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY} ${SANITIZER_COMMON_LINK_LIBS})
3939

4040
append_list_if(COMPILER_RT_HAS_LIBDL dl UBSAN_DYNAMIC_LIBS)
4141
append_list_if(COMPILER_RT_HAS_LIBLOG log UBSAN_DYNAMIC_LIBS)
4242
append_list_if(COMPILER_RT_HAS_LIBRT rt UBSAN_DYNAMIC_LIBS)
4343
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread UBSAN_DYNAMIC_LIBS)
4444

45-
list(APPEND UBSAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
46-
4745
add_compiler_rt_component(ubsan)
4846

4947
if(APPLE)

0 commit comments

Comments
 (0)
Please sign in to comment.