summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ELFWriter.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-07-28 19:25:33 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-07-28 19:25:33 +0000
commitc6c5dbd5b80cae7af95eda9e7cbfe2c4e81959d2 (patch)
tree767d260dab4b6384c2b51767c76112e2861f8155 /llvm/lib/CodeGen/ELFWriter.cpp
parentfaf0c64d9d873cfde88fc512d1b47174e2109604 (diff)
downloadbcm5719-llvm-c6c5dbd5b80cae7af95eda9e7cbfe2c4e81959d2.tar.gz
bcm5719-llvm-c6c5dbd5b80cae7af95eda9e7cbfe2c4e81959d2.zip
Handle null and file symbol on doInitialization
llvm-svn: 77354
Diffstat (limited to 'llvm/lib/CodeGen/ELFWriter.cpp')
-rw-r--r--llvm/lib/CodeGen/ELFWriter.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp
index fe2ba262446..5587b520237 100644
--- a/llvm/lib/CodeGen/ELFWriter.cpp
+++ b/llvm/lib/CodeGen/ELFWriter.cpp
@@ -143,6 +143,11 @@ bool ELFWriter::doInitialization(Module &M) {
// Add the null section, which is required to be first in the file.
getNullSection();
+ // The first entry in the symtab is the null symbol and the second
+ // is a local symbol containing the module/file name
+ SymbolList.push_back(new ELFSym());
+ SymbolList.push_back(ELFSym::getFileSym());
+
return false;
}
@@ -189,7 +194,7 @@ ELFSection &ELFWriter::getConstantPoolSection(MachineConstantPoolEntry &CPE) {
const TargetLoweringObjectFile &TLOF =
TM.getTargetLowering()->getObjFileLowering();
-
+
return getSection(TLOF.getSectionForMergeableConstant(Kind)->getName(),
ELFSection::SHT_PROGBITS,
ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC,
@@ -320,7 +325,7 @@ void ELFWriter::EmitGlobal(const GlobalValue *GV) {
const TargetLoweringObjectFile &TLOF =
TM.getTargetLowering()->getObjFileLowering();
- // Get ELF section from TAI
+ // Get the ELF section where this global belongs from TLOF
const Section *S = TLOF.SectionForGlobal(GV, TM);
unsigned SectionFlags = getElfSectionFlags(S->getKind());
@@ -522,9 +527,6 @@ bool ELFWriter::doFinalization(Module &M) {
if (TAI->getNonexecutableStackDirective())
getNonExecStackSection();
- // Emit module name
- SymbolList.push_back(ELFSym::getFileSym());
-
// Emit a symbol for each section created until now, skip null section
for (unsigned i = 1, e = SectionList.size(); i < e; ++i) {
ELFSection &ES = *SectionList[i];
@@ -798,9 +800,6 @@ void ELFWriter::EmitSymbolTable() {
// Size of each symtab entry.
SymTab.EntSize = TEW->getSymTabEntrySize();
- // The first entry in the symtab is the null symbol
- SymbolList.insert(SymbolList.begin(), new ELFSym());
-
// Reorder the symbol table with local symbols first!
unsigned FirstNonLocalSymbol = SortSymbols();
OpenPOWER on IntegriCloud