[llvm] r261794 - [asan] Do not instrument globals in the special "LLVM" sections

Anna Zaks via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 14:12:18 PST 2016


Author: zaks
Date: Wed Feb 24 16:12:18 2016
New Revision: 261794

URL: http://llvm.org/viewvc/llvm-project?rev=261794&view=rev
Log:
[asan] Do not instrument globals in the special "LLVM" sections

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=261794&r1=261793&r2=261794&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Feb 24 16:12:18 2016
@@ -1228,7 +1228,7 @@ bool AddressSanitizerModule::ShouldInstr
     // Globals from llvm.metadata aren't emitted, do not instrument them.
     if (Section == "llvm.metadata") return false;
     // Do not instrument globals from special LLVM sections.
-    if (Section.find("__llvm") != StringRef::npos) return false;
+    if (Section.find("__llvm") != StringRef::npos || Section.find("__LLVM") != StringRef::npos) return false;
 
     // Do not instrument function pointers to initialization and termination
     // routines: dynamic linker will not properly handle redzones.

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll?rev=261794&r1=261793&r2=261794&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll Wed Feb 24 16:12:18 2016
@@ -11,9 +11,11 @@ target triple = "x86_64-apple-macosx10.1
 
 @.str_noinst = private unnamed_addr constant [4 x i8] c"aaa\00", section "llvm.metadata"
 @.str_noinst_prof = private unnamed_addr constant [4 x i8] c"aaa\00", section "__DATA,__llvm_covmap"
+ at .str_noinst_LLVM = private unnamed_addr constant [4 x i8] c"aaa\00", section "__LLVM,__not_visible"
 @.str_inst = private unnamed_addr constant [4 x i8] c"aaa\00"
 
 ; CHECK-NOT: {{asan_gen.*str_noinst}}
 ; CHECK-NOT: {{asan_gen.*str_noinst_prof}}
+; CHECK-NOT: {{asan_gen.*str_noinst_LLVM}}
 ; CHECK: {{asan_gen.*str_inst}}
 ; CHECK: @asan.module_ctor




More information about the llvm-commits mailing list