[PATCH] D18691: [ELF] - Split Writer::assignAddresses(): extract code for initializing dummies sections
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 1 10:10:05 PDT 2016
grimar retitled this revision from "[ELF] - Split Writer::assignAddresses(): extract code for initializing dummies sections to fixDummiesSections()" to "[ELF] - Split Writer::assignAddresses(): extract code for initializing dummies sections".
grimar updated the summary for this revision.
grimar updated this revision to Diff 52390.
grimar added a comment.
- Addressed review comments.
http://reviews.llvm.org/D18691
Files:
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -130,6 +130,7 @@
template <class ELFT> void elf::writeResult(SymbolTable<ELFT> *Symtab) {
typedef typename ELFT::uint uintX_t;
+ typedef typename ELFT::Ehdr Elf_Ehdr;
// Create singleton output sections.
DynamicSection<ELFT> Dynamic(*Symtab);
@@ -205,6 +206,7 @@
Out<ELFT>::TlsPhdr = nullptr;
Out<ELFT>::ElfHeader = &ElfHeader;
Out<ELFT>::ProgramHeaders = &ProgramHeaders;
+ Out<ELFT>::ElfHeader->setSize(sizeof(Elf_Ehdr));
Writer<ELFT>(*Symtab).run();
}
@@ -1333,6 +1335,9 @@
if (Note.First)
Phdrs.push_back(std::move(Note));
+
+ size_t PhdrSize = sizeof(Elf_Phdr) * Phdrs.size();
+ Out<ELFT>::ProgramHeaders->setSize(PhdrSize);
}
// The first section of each PT_LOAD and the first section after PT_GNU_RELRO
@@ -1372,7 +1377,6 @@
// header, do not create program headers. Also assign of section addresses
// is very straightforward: we just put all sections sequentually to the file.
template <class ELFT> void Writer<ELFT>::assignAddressesRelocatable() {
- Out<ELFT>::ElfHeader->setSize(sizeof(Elf_Ehdr));
uintX_t FileOff = 0;
for (OutputSectionBase<ELFT> *Sec : OutputSections)
FileOff = fixFileOff(FileOff, Sec->getAlign(), Sec);
@@ -1383,10 +1387,6 @@
// Visits all headers in PhdrTable and assigns the adresses to
// the output sections. Also creates common and special headers.
template <class ELFT> void Writer<ELFT>::assignAddresses() {
- Out<ELFT>::ElfHeader->setSize(sizeof(Elf_Ehdr));
- size_t PhdrSize = sizeof(Elf_Phdr) * Phdrs.size();
- Out<ELFT>::ProgramHeaders->setSize(PhdrSize);
-
uintX_t ThreadBssOffset = 0;
uintX_t VA = Target->getVAStart();
uintX_t FileOff = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18691.52390.patch
Type: text/x-patch
Size: 1794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160401/bea30d2a/attachment.bin>
More information about the llvm-commits
mailing list