]> granicus.if.org Git - clang/commit
Update link strategy for sanitizer runtime libraries on Linux:
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 18 Aug 2014 22:10:42 +0000 (22:10 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 18 Aug 2014 22:10:42 +0000 (22:10 +0000)
commit8312572eaa14de7bfdf3b637b9721b5c4768ddaf
tree1335846213aedda3ca82f95c11a35a231eb2718c
parent6dc4e613eb8c3da6f1b83e4b121560ce7f197698
Update link strategy for sanitizer runtime libraries on Linux:

1. Always put static sanitizer runtimes to the front of the linker
invocation line. This was already done for all sanitizers except UBSan:
in case user provides static libstdc++ we need to make sure that new/delete
operator definitions are picked from sanitizer runtimes instead of libstdc++.
We have to put UBSan runtime first for similar reasons: it depends on some
libstdc++ parts (e.g. __dynamic_cast function), and has to go first in
link line to ensure these functions will be picked up from libstdc++.

2. Put sanitizer libraries system dependencies (-ldl, -lpthread etc.) right
after sanitizer runtimes. This will ensure these libraries participate in
the link even if user provided -Wl,-as-needed flag. This should fix PR15823.

3. In case we link in several sanitizer runtimes (e.g. "ubsan", "ubsan_cxx"
and "san"), add system dependencies (-ldl, -lpthread, ...) only once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215940 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Driver/Tools.cpp
test/Driver/sanitizer-ld.c