summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-09-14 14:06:33 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-09-14 14:06:33 +0000
commita1ea64a0443ca482821f87ca117af1daaa22c044 (patch)
tree985132645b896cad5a0d806400ea47aa2106160a /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
parentac772c3c2f56639d4de27f6a31fc3bc29bfe1849 (diff)
downloadbcm5719-llvm-a1ea64a0443ca482821f87ca117af1daaa22c044.tar.gz
bcm5719-llvm-a1ea64a0443ca482821f87ca117af1daaa22c044.zip
[asan] Enable -asan-use-private-alias on Darwin/Mach-O, add test for ODR false positive with LTO (llvm part)
The '-asan-use-private-alias’ option (disabled by default) option is currently only enabled for Linux and ELF, but it also works on Darwin and Mach-O. This option also fixes a known problem with LTO on Darwin (https://github.com/google/sanitizers/issues/647). This patch enables the support for Darwin (but still keeps it off by default) and adds the LTO test case. Differential Revision: https://reviews.llvm.org/D24292 llvm-svn: 281470
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 1850b0c56ec..7546414a296 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1605,7 +1605,8 @@ bool AddressSanitizerModule::InstrumentGlobals(IRBuilder<> &IRB, Module &M) {
Constant *ODRIndicator = ConstantExpr::getNullValue(IRB.getInt8PtrTy());
GlobalValue *InstrumentedGlobal = NewGlobal;
- bool CanUsePrivateAliases = TargetTriple.isOSBinFormatELF();
+ bool CanUsePrivateAliases =
+ TargetTriple.isOSBinFormatELF() || TargetTriple.isOSBinFormatMachO();
if (CanUsePrivateAliases && ClUsePrivateAliasForGlobals) {
// Create local alias for NewGlobal to avoid crash on ODR between
// instrumented and non-instrumented libraries.
OpenPOWER on IntegriCloud