[PATCH] D28360: [clang] Update clang driver to include san_common to compiler-rt libraries when necessary.
Marcos Pividori via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 08:54:32 PST 2017
mpividori created this revision.
mpividori added reviewers: kcc, rnk, zturner.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.
Herald added a subscriber: dberris.
This diff include changes to clang Driver related to previous modifications in compiler-rt: https://reviews.llvm.org/D28359
Repository:
rL LLVM
https://reviews.llvm.org/D28360
Files:
lib/Driver/Tools.cpp
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3278,6 +3278,7 @@
SmallVectorImpl<StringRef> &HelperStaticRuntimes,
SmallVectorImpl<StringRef> &RequiredSymbols) {
const SanitizerArgs &SanArgs = TC.getSanitizerArgs();
+ bool NeedSanCommon = false;
// Collect shared runtimes.
if (SanArgs.needsAsanRt() && SanArgs.needsSharedAsanRt()) {
SharedRuntimes.push_back("asan");
@@ -3296,44 +3297,60 @@
HelperStaticRuntimes.push_back("asan-preinit");
} else {
StaticRuntimes.push_back("asan");
+ NeedSanCommon = true;
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("asan_cxx");
}
}
- if (SanArgs.needsDfsanRt())
+ if (SanArgs.needsDfsanRt()) {
StaticRuntimes.push_back("dfsan");
- if (SanArgs.needsLsanRt())
+ NeedSanCommon = true;
+ }
+ if (SanArgs.needsLsanRt()) {
StaticRuntimes.push_back("lsan");
+ NeedSanCommon = true;
+ }
if (SanArgs.needsMsanRt()) {
StaticRuntimes.push_back("msan");
+ NeedSanCommon = true;
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("msan_cxx");
}
if (SanArgs.needsTsanRt()) {
StaticRuntimes.push_back("tsan");
+ NeedSanCommon = true;
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("tsan_cxx");
}
if (SanArgs.needsUbsanRt()) {
StaticRuntimes.push_back("ubsan_standalone");
+ NeedSanCommon = true;
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("ubsan_standalone_cxx");
}
if (SanArgs.needsSafeStackRt())
StaticRuntimes.push_back("safestack");
- if (SanArgs.needsCfiRt())
+ if (SanArgs.needsCfiRt()) {
StaticRuntimes.push_back("cfi");
+ NeedSanCommon = true;
+ }
if (SanArgs.needsCfiDiagRt()) {
StaticRuntimes.push_back("cfi_diag");
+ NeedSanCommon = true;
if (SanArgs.linkCXXRuntimes())
StaticRuntimes.push_back("ubsan_standalone_cxx");
}
if (SanArgs.needsStatsRt()) {
NonWholeStaticRuntimes.push_back("stats");
+ NeedSanCommon = true;
RequiredSymbols.push_back("__sanitizer_stats_register");
}
- if (SanArgs.needsEsanRt())
+ if (SanArgs.needsEsanRt()) {
StaticRuntimes.push_back("esan");
+ NeedSanCommon = true;
+ }
+ if (NeedSanCommon)
+ StaticRuntimes.push_back("san_common");
}
// Should be called before we add system libraries (C++ ABI, libstdc++/libc++,
@@ -3380,6 +3397,7 @@
options::OPT_fnoxray_instrument, false)) {
CmdArgs.push_back("-whole-archive");
CmdArgs.push_back(TC.getCompilerRTArgString(Args, "xray", false));
+ CmdArgs.push_back(TC.getCompilerRTArgString(Args, "san_common", false));
CmdArgs.push_back("-no-whole-archive");
return true;
}
@@ -10904,7 +10922,7 @@
} 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", "san_common"})
CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28360.83251.patch
Type: text/x-patch
Size: 3195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/67b17cbd/attachment-0001.bin>
More information about the llvm-commits
mailing list