diff options
author | Marcos Pividori <mpividori@google.com> | 2017-02-09 18:22:35 +0000 |
---|---|---|
committer | Marcos Pividori <mpividori@google.com> | 2017-02-09 18:22:35 +0000 |
commit | 147f62fc0b1796ad27a6fb9f8cbbd60aac0b757d (patch) | |
tree | a661d1276c8af19ea6d2a3ae7a454d5b0b8210ec | |
parent | 21b4b2ea94e1adb0364399d7bbba89e28bdb053d (diff) | |
download | bcm5719-llvm-147f62fc0b1796ad27a6fb9f8cbbd60aac0b757d.tar.gz bcm5719-llvm-147f62fc0b1796ad27a6fb9f8cbbd60aac0b757d.zip |
[windows] [asan] Add wholearchive flag when including asan_cxx lib.
We need -wholearchive for asan_cxx, the same than for asan.
Clang Driver will add asan_cxx at the beginning of the arg list that we pass to
the linker. To ensure that all the static libraries are linked to asan_cxx, we
force the linker to include the object files in asan_cxx.
This fixes some linker errors when compiling with address sanitizer for MT and
passing the static library libFuzzer.
Differential Revision: https://reviews.llvm.org/D29754
llvm-svn: 294604
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 1eddefd4f03..7b48e1da921 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -11006,13 +11006,14 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, } else if (DLL) { CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk")); } else { - for (const auto &Lib : {"asan", "asan_cxx"}) + for (const auto &Lib : {"asan", "asan_cxx"}) { CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib)); - // Make sure the linker consider all object files from the static library. - // This is necessary because instrumented dlls need access to all the - // interface exported by the static lib in the main executable. - CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") + - TC.getCompilerRT(Args, "asan"))); + // Make sure the linker consider all object files from the static lib. + // This is necessary because instrumented dlls need access to all the + // interface exported by the static lib in the main executable. + CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") + + TC.getCompilerRT(Args, Lib))); + } } } |