mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Base check on the section name, not the variable name.
The variable is private, so the name should not be relied on. Also, the linker uses the sections, so asan should too when trying to avoid causing the linker problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221480 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0ea3b243b0
commit
d8eb4f1912
@ -971,16 +971,6 @@ bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) {
|
|||||||
// For now, just ignore this Global if the alignment is large.
|
// For now, just ignore this Global if the alignment is large.
|
||||||
if (G->getAlignment() > MinRedzoneSizeForGlobal()) return false;
|
if (G->getAlignment() > MinRedzoneSizeForGlobal()) return false;
|
||||||
|
|
||||||
// Ignore all the globals with the names starting with "\01L_OBJC_".
|
|
||||||
// Many of those are put into the .cstring section. The linker compresses
|
|
||||||
// that section by removing the spare \0s after the string terminator, so
|
|
||||||
// our redzones get broken.
|
|
||||||
if ((G->getName().find("\01L_OBJC_") == 0) ||
|
|
||||||
(G->getName().find("\01l_OBJC_") == 0)) {
|
|
||||||
DEBUG(dbgs() << "Ignoring \\01L_OBJC_* global: " << *G << "\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (G->hasSection()) {
|
if (G->hasSection()) {
|
||||||
StringRef Section(G->getSection());
|
StringRef Section(G->getSection());
|
||||||
// Ignore the globals from the __OBJC section. The ObjC runtime assumes
|
// Ignore the globals from the __OBJC section. The ObjC runtime assumes
|
||||||
@ -1009,6 +999,11 @@ bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) {
|
|||||||
DEBUG(dbgs() << "Ignoring a cstring literal: " << *G << "\n");
|
DEBUG(dbgs() << "Ignoring a cstring literal: " << *G << "\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (Section.startswith("__TEXT,__objc_methname,cstring_literals")) {
|
||||||
|
DEBUG(dbgs() << "Ignoring objc_methname cstring global: " << *G << "\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Callbacks put into the CRT initializer/terminator sections
|
// Callbacks put into the CRT initializer/terminator sections
|
||||||
// should not be instrumented.
|
// should not be instrumented.
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
; RUN: opt < %s -asan -asan-module -S | FileCheck %s
|
||||||
|
|
||||||
|
target datalayout = "e"
|
||||||
|
|
||||||
|
@foo = private global [19 x i8] c"scannerWithString:\00", section "__TEXT,__objc_methname,cstring_literals"
|
||||||
|
|
||||||
|
; CHECK: @foo = private global [19 x i8] c"scannerWithString:\00", section "__TEXT,__objc_methname,cstring_literals"
|
Loading…
Reference in New Issue
Block a user