Revert r185872 - "Stop emitting weak symbols into the "coal" sections"

This patch broke `make check-asan` on Mac, causing ld warnings like the following one:

ld: warning: direct access in __GLOBAL__I_a to global weak symbol
___asan_mapping_scale means the weak symbol cannot be overridden at
runtime. This was likely caused by different translation units being
compiled with different visibility settings.

The resulting test binaries crashed with incorrect ASan warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185923 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexander Potapenko
2013-07-09 10:00:16 +00:00
parent 9fb5a6588b
commit 9467b3e0ac
3 changed files with 10 additions and 83 deletions
+6 -6
View File
@@ -524,14 +524,14 @@ const MCSection *TargetLoweringObjectFileMachO::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const {
if (Kind.isText())
return TextSection;
// If this is weak/linkonce, put this in a read only or data section depending
// on whether or not it's writable.
return GV->isWeakForLinker() ? TextCoalSection : TextSection;
// If this is weak/linkonce, put this in a coalescable section, either in text
// or data depending on if it is writable.
if (GV->isWeakForLinker()) {
if (Kind.isReadOnly())
return ReadOnlySection;
return DataSection;
return ConstTextCoalSection;
return DataCoalSection;
}
// FIXME: Alignment check should be handled by section classifier.