[llvm-commits] [llvm] r73895 - in /llvm/trunk/lib/CodeGen: ELFWriter.cpp ELFWriter.h
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Mon Jun 22 12:29:57 PDT 2009
Author: bruno
Date: Mon Jun 22 14:29:56 2009
New Revision: 73895
URL: http://llvm.org/viewvc/llvm-project?rev=73895&view=rev
Log:
Use different functions to emit the string and symbol tables.
Modified:
llvm/trunk/lib/CodeGen/ELFWriter.cpp
llvm/trunk/lib/CodeGen/ELFWriter.h
Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=73895&r1=73894&r2=73895&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Jun 22 14:29:56 2009
@@ -386,6 +386,9 @@
if (TAI->getNonexecutableStackDirective())
getNonExecStackSection();
+ // Emit string table
+ EmitStringTable();
+
// Emit the symbol table now, if non-empty.
EmitSymbolTable();
@@ -518,12 +521,10 @@
}
}
-/// EmitSymbolTable - If the current symbol table is non-empty, emit the string
-/// table for it and then the symbol table itself.
-void ELFWriter::EmitSymbolTable() {
+/// EmitStringTable - If the current symbol table is non-empty, emit the string
+/// table for it
+void ELFWriter::EmitStringTable() {
if (!SymbolList.size()) return; // Empty symbol table.
-
- unsigned FirstNonLocalSymbol = 1;
ELFSection &StrTab = getStringTableSection();
// Set the zero'th symbol to a null byte, as required.
@@ -550,12 +551,20 @@
}
assert(Index == StrTab.size());
StrTab.Size = Index;
+}
+/// EmitSymbolTable - Emit the symbol table itself.
+void ELFWriter::EmitSymbolTable() {
+ if (!SymbolList.size()) return; // Empty symbol table.
+
+ unsigned FirstNonLocalSymbol = 1;
// Now that we have emitted the string table and know the offset into the
// string table of each symbol, emit the symbol table itself.
ELFSection &SymTab = getSymbolTableSection();
SymTab.Align = TEW->getPrefELFAlignment();
- SymTab.Link = StrTab.SectionIdx; // Section Index of .strtab.
+
+ // Section Index of .strtab.
+ SymTab.Link = getStringTableSection().SectionIdx;
// Size of each symtab entry.
SymTab.EntSize = TEW->getSymTabEntrySize();
@@ -566,7 +575,7 @@
// Emit all the symbols to the symbol table. Skip the null
// symbol, cause it's emitted already
- Index = 1;
+ unsigned Index = 1;
for (std::list<ELFSym>::iterator I = SymbolList.begin(),
E = SymbolList.end(); I != E; ++I, ++Index) {
// Keep track of the first non-local symbol
Modified: llvm/trunk/lib/CodeGen/ELFWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=73895&r1=73894&r2=73895&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.h (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.h Mon Jun 22 14:29:56 2009
@@ -207,6 +207,7 @@
void EmitSectionTableStringTable();
void EmitSymbol(BinaryObject &SymbolTable, ELFSym &Sym);
void EmitSymbolTable();
+ void EmitStringTable();
void OutputSectionsAndSectionTable();
};
}
More information about the llvm-commits
mailing list