r294604 - [windows] [asan] Add wholearchive flag when including asan_cxx lib.
Marcos Pividori via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 9 10:22:35 PST 2017
Author: mpividori
Date: Thu Feb 9 12:22:35 2017
New Revision: 294604
URL: http://llvm.org/viewvc/llvm-project?rev=294604&view=rev
Log:
[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
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294604&r1=294603&r2=294604&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Feb 9 12:22:35 2017
@@ -11006,13 +11006,14 @@ void visualstudio::Linker::ConstructJob(
} 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)));
+ }
}
}
More information about the cfe-commits
mailing list