Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 62660f0

Browse files
committed
[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 (google/sanitizers#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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281470 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9502e5b commit 62660f0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Transforms/Instrumentation/AddressSanitizer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,8 @@ bool AddressSanitizerModule::InstrumentGlobals(IRBuilder<> &IRB, Module &M) {
16051605
Constant *ODRIndicator = ConstantExpr::getNullValue(IRB.getInt8PtrTy());
16061606
GlobalValue *InstrumentedGlobal = NewGlobal;
16071607

1608-
bool CanUsePrivateAliases = TargetTriple.isOSBinFormatELF();
1608+
bool CanUsePrivateAliases =
1609+
TargetTriple.isOSBinFormatELF() || TargetTriple.isOSBinFormatMachO();
16091610
if (CanUsePrivateAliases && ClUsePrivateAliasForGlobals) {
16101611
// Create local alias for NewGlobal to avoid crash on ODR between
16111612
// instrumented and non-instrumented libraries.

0 commit comments

Comments
 (0)