[llvm] r349707 - [asan] Undo special treatment of linkonce_odr and weak_odr

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 19 16:30:27 PST 2018


Author: vitalybuka
Date: Wed Dec 19 16:30:27 2018
New Revision: 349707

URL: http://llvm.org/viewvc/llvm-project?rev=349707&view=rev
Log:
[asan] Undo special treatment of linkonce_odr and weak_odr

Summary:
On non-Windows these are already removed by ShouldInstrumentGlobal.
On Window we will wait until we get actual issues with that.

Reviewers: pcc

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D55899

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    llvm/trunk/test/Instrumentation/AddressSanitizer/win-string-literal.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=349707&r1=349706&r2=349707&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Dec 19 16:30:27 2018
@@ -2201,10 +2201,8 @@ bool AddressSanitizerModule::InstrumentG
           GlobalAlias::create(GlobalValue::PrivateLinkage, "", NewGlobal);
     }
 
-    // ODR check is not useful for the following, but we see false reports
-    // caused by linker optimizations.
-    if (NewGlobal->hasLocalLinkage() || NewGlobal->hasLinkOnceODRLinkage() ||
-        NewGlobal->hasWeakODRLinkage()) {
+    // ODR should not happen for local linkage.
+    if (NewGlobal->hasLocalLinkage()) {
       ODRIndicator = ConstantExpr::getIntToPtr(ConstantInt::get(IntptrTy, -1),
                                                IRB.getInt8PtrTy());
     } else if (UseOdrIndicator) {

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/win-string-literal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/win-string-literal.ll?rev=349707&r1=349706&r2=349707&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/win-string-literal.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/win-string-literal.ll Wed Dec 19 16:30:27 2018
@@ -15,7 +15,7 @@
 ; CHECK-SAME: { i64 ptrtoint ({ [5 x i8], [59 x i8] }* @"??_C at _04JIHMPGLA@asdf?$AA@" to i64),
 ; CHECK-SAME:   i64 5, i64 64, i64 ptrtoint ([17 x i8]* @___asan_gen_.1 to i64),
 ; CHECK-SAME:   i64 ptrtoint ([8 x i8]* @___asan_gen_ to i64), i64 0,
-; CHECK-SAME:   i64 ptrtoint ({ [6 x i8]*, i32, i32 }* @___asan_gen_.3 to i64), i64 -1 },
+; CHECK-SAME:   i64 ptrtoint ({ [6 x i8]*, i32, i32 }* @___asan_gen_.3 to i64), i64 0 },
 ; CHECK-SAME:   section ".ASAN$GL", comdat($"??_C at _04JIHMPGLA@asdf?$AA@"), align 64
 
 ; ModuleID = 't.cpp'




More information about the llvm-commits mailing list