diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-02-14 22:23:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-02-14 22:23:49 +0000 |
commit | 70d8015063bb7b884f516d2163c124bb0c3233a8 (patch) | |
tree | 2c80222978c680e9d4183aed92f4fba3b5826d07 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 60f50bc9f1c62b05db825a4b0a902b821bdc51f5 (diff) | |
download | bcm5719-llvm-70d8015063bb7b884f516d2163c124bb0c3233a8.tar.gz bcm5719-llvm-70d8015063bb7b884f516d2163c124bb0c3233a8.zip |
Switch llvm to using comdats. For now always use groups with a single
section.
llvm-svn: 125526
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 5a0e2cfa30b..cc278658d09 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -266,22 +266,6 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, getELFSectionFlags(Kind), Kind); } -static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { - if (Kind.isText()) return ".gnu.linkonce.t."; - if (Kind.isReadOnly()) return ".gnu.linkonce.r."; - - if (Kind.isThreadData()) return ".gnu.linkonce.td."; - if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; - - if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; - if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; - if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; - if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local."; - - assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); - return ".gnu.linkonce.d.rel.ro."; -} - /// getSectionPrefixForGlobal - Return the section prefix name used by options /// FunctionsSections and DataSections. static const char *getSectionPrefixForGlobal(SectionKind Kind) { @@ -317,19 +301,21 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, if ((GV->isWeakForLinker() || EmitUniquedSection) && !Kind.isCommon() && !Kind.isBSS()) { const char *Prefix; - if (GV->isWeakForLinker()) - Prefix = getSectionPrefixForUniqueGlobal(Kind); - else { - assert(EmitUniquedSection); - Prefix = getSectionPrefixForGlobal(Kind); - } + Prefix = getSectionPrefixForGlobal(Kind); SmallString<128> Name(Prefix, Prefix+strlen(Prefix)); MCSymbol *Sym = Mang->getSymbol(GV); Name.append(Sym->getName().begin(), Sym->getName().end()); + StringRef Group = ""; + unsigned Flags = getELFSectionFlags(Kind); + if (GV->isWeakForLinker()) { + Group = Sym->getName(); + Flags |= ELF::SHF_GROUP; + } + return getContext().getELFSection(Name.str(), getELFSectionType(Name.str(), Kind), - getELFSectionFlags(Kind), Kind); + Flags, Kind, 0, Group); } if (Kind.isText()) return TextSection; |