diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-19 03:06:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-19 03:06:01 +0000 |
commit | a986aa33eb01bfa34a1fd0858a93311c692c2ea4 (patch) | |
tree | 26c5e03e740e3cc08081d4bd52a9cc844092d3db /llvm/lib/Target/TargetLoweringObjectFile.cpp | |
parent | 5b585f8b1a6f5c2531333d533c263746a648e81c (diff) | |
download | bcm5719-llvm-a986aa33eb01bfa34a1fd0858a93311c692c2ea4.tar.gz bcm5719-llvm-a986aa33eb01bfa34a1fd0858a93311c692c2ea4.zip |
fix a significant difference between llvm and gcc on ELF systems:
GCC would put weak zero initialized mutable data in the .bss section,
we would put it into a crasy '.gnu.linkonce.b.test,"aw",@nobits'
section. Fixing this will allow simplifications next up.
llvm-svn: 93844
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r-- | llvm/lib/Target/TargetLoweringObjectFile.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index cd0558025b8..7b00b332f63 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -565,7 +565,6 @@ static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { if (Kind.isThreadData()) return ".gnu.linkonce.td."; if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; - if (Kind.isBSS()) return ".gnu.linkonce.b."; if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; @@ -581,7 +580,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, // If this global is linkonce/weak and the target handles this by emitting it // into a 'uniqued' section name, create and return the section now. - if (GV->isWeakForLinker() && !Kind.isCommon()) { + if (GV->isWeakForLinker() && !Kind.isCommon() && !Kind.isBSS()) { const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); SmallString<128> Name; Name.append(Prefix, Prefix+strlen(Prefix)); @@ -634,6 +633,9 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, if (Kind.isThreadData()) return TLSDataSection; if (Kind.isThreadBSS()) return TLSBSSSection; + // Note: we claim that common symbols are put in BSSSection, but they are + // really emitted with the magic .comm directive, which creates a symbol table + // entry but not a section. if (Kind.isBSS() || Kind.isCommon()) return BSSSection; if (Kind.isDataNoRel()) return DataSection; |