mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-03 00:33:09 +00:00
Fix compilation of ASan tests on OS X Lion (see http://code.google.com/p/address-sanitizer/issues/detail?id=32)
The redzones emitted by AddressSanitizer for CFString instances confuse the linker and are of little use, so we shouldn't add them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149243 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b9a2d6ff38
commit
8375bc9236
@ -422,16 +422,28 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore the globals from the __OBJC section. The ObjC runtime assumes
|
|
||||||
// those conform to /usr/lib/objc/runtime.h, so we can't add redzones to
|
|
||||||
// them.
|
|
||||||
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
|
||||||
|
// those conform to /usr/lib/objc/runtime.h, so we can't add redzones to
|
||||||
|
// them.
|
||||||
if ((Section.find("__OBJC,") == 0) ||
|
if ((Section.find("__OBJC,") == 0) ||
|
||||||
(Section.find("__DATA, __objc_") == 0)) {
|
(Section.find("__DATA, __objc_") == 0)) {
|
||||||
DEBUG(dbgs() << "Ignoring ObjC runtime global: " << *G);
|
DEBUG(dbgs() << "Ignoring ObjC runtime global: " << *G);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// See http://code.google.com/p/address-sanitizer/issues/detail?id=32
|
||||||
|
// Constant CFString instances are compiled in the following way:
|
||||||
|
// -- the string buffer is emitted into
|
||||||
|
// __TEXT,__cstring,cstring_literals
|
||||||
|
// -- the constant NSConstantString structure referencing that buffer
|
||||||
|
// is placed into __DATA,__cfstring
|
||||||
|
// Therefore there's no point in placing redzones into __DATA,__cfstring.
|
||||||
|
// Moreover, it causes the linker to crash on OS X 10.7
|
||||||
|
if (Section.find("__DATA,__cfstring") == 0) {
|
||||||
|
DEBUG(dbgs() << "Ignoring CFString: " << *G);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalsToChange.push_back(G);
|
GlobalsToChange.push_back(G);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user