From: Anna Zaks Date: Wed, 24 Feb 2016 22:12:18 +0000 (+0000) Subject: [asan] Do not instrument globals in the special "LLVM" sections X-Git-Tag: llvmorg-3.9.0-rc1~13318 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40148f1716b5c75f0614e502de82bf1c92fd1b4c;p=platform%2Fupstream%2Fllvm.git [asan] Do not instrument globals in the special "LLVM" sections llvm-svn: 261794 --- diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 2f404fe..fff6279 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1228,7 +1228,7 @@ bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) { // 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. diff --git a/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll b/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll index 854f5cb..0ca8975 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-globals-darwin.ll @@ -11,9 +11,11 @@ target triple = "x86_64-apple-macosx10.10.0" @.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" +@.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