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

Commit 383790d

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 ae01c87 commit 383790d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,8 @@ bool AddressSanitizerModule::InstrumentGlobals(IRBuilder<> &IRB, Module &M) {
15361536
Constant *ODRIndicator = ConstantExpr::getNullValue(IRB.getInt8PtrTy());
15371537
GlobalValue *InstrumentedGlobal = NewGlobal;
15381538

1539-
bool CanUsePrivateAliases = TargetTriple.isOSBinFormatELF();
1539+
bool CanUsePrivateAliases =
1540+
TargetTriple.isOSBinFormatELF() || TargetTriple.isOSBinFormatMachO();
15401541
if (CanUsePrivateAliases && ClUsePrivateAliasForGlobals) {
15411542
// Create local alias for NewGlobal to avoid crash on ODR between
15421543
// instrumented and non-instrumented libraries.

0 commit comments

Comments
 (0)