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 | 85bc995c5bdd5c5b2a7b12284ea35d6e4deb6ceb (patch) | |
tree | 91521b523cdb9d20bb895d414d41864a17d64aa1 /llvm/lib/CodeGen/ELFWriter.cpp | |
parent | 90d1dfe4c6e6cbad825017757ed45f4a66000f40 (diff) | |
download | bcm5719-llvm-85bc995c5bdd5c5b2a7b12284ea35d6e4deb6ceb.tar.gz bcm5719-llvm-85bc995c5bdd5c5b2a7b12284ea35d6e4deb6ceb.zip |
Move broken HasCommonSymbols to ELFWriter.cpp.
llvm-svn: 125490
Diffstat (limited to 'llvm/lib/CodeGen/ELFWriter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ELFWriter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp index 2da62449320..0fd1e8e83bd 100644 --- a/llvm/lib/CodeGen/ELFWriter.cpp +++ b/llvm/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 |