diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-02-14 16:51:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-02-14 16:51:08 +0000 |
commit | 9de3a0701a06505aeab824fdc88f361a5018e473 (patch) | |
tree | 58c8c640ba84b9f4449194a0220e16397d40689d /lib/CodeGen/ELFWriter.cpp | |
parent | a2b6e4151b75248f9dbf8067186cba673520f8f4 (diff) | |
download | external_llvm-9de3a0701a06505aeab824fdc88f361a5018e473.tar.gz external_llvm-9de3a0701a06505aeab824fdc88f361a5018e473.tar.bz2 external_llvm-9de3a0701a06505aeab824fdc88f361a5018e473.zip |
Move broken HasCommonSymbols to ELFWriter.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125490 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ELFWriter.cpp')
-rw-r--r-- | lib/CodeGen/ELFWriter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index 2da6244932..0fd1e8e83b 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -328,6 +328,18 @@ void ELFWriter::AddToSymbolList(ELFSym *GblSym) { } } +/// HasCommonSymbols - True if this section holds common symbols, this is +/// indicated on the ELF object file by a symbol with SHN_COMMON section +/// header index. +static bool HasCommonSymbols(const MCSectionELF &S) { + // FIXME: this is wrong, a common symbol can be in .data for example. + if (StringRef(S.getSectionName()).startswith(".gnu.linkonce.")) + return true; + + return false; +} + + // EmitGlobal - Choose the right section for global and emit it void ELFWriter::EmitGlobal(const GlobalValue *GV) { @@ -364,7 +376,7 @@ void ELFWriter::EmitGlobal(const GlobalValue *GV) { unsigned Size = TD->getTypeAllocSize(GVar->getInitializer()->getType()); GblSym->Size = Size; - if (S->HasCommonSymbols()) { // Symbol must go to a common section + if (HasCommonSymbols(*S)) { // Symbol must go to a common section GblSym->SectionIdx = ELF::SHN_COMMON; // A new linkonce section is created for each global in the |