forked from OSchip/llvm-project
Use assignAddresses with -r.
Before this patch in -r we compute the OutputSection sizes early in the various calls to assignOffsets. With this change we can remove most of those calls. llvm-svn: 304860
This commit is contained in:
parent
7dee171f69
commit
189860c317
|
@ -268,22 +268,24 @@ template <class ELFT> void Writer<ELFT>::run() {
|
|||
OutputSectionCommands.begin(), OutputSectionCommands.end(),
|
||||
[](OutputSectionCommand *Cmd) { Cmd->maybeCompress<ELFT>(); });
|
||||
|
||||
if (Config->Relocatable) {
|
||||
Script->assignAddresses(Phdrs, OutputSectionCommands);
|
||||
|
||||
// Remove empty PT_LOAD to avoid causing the dynamic linker to try to mmap a
|
||||
// 0 sized region. This has to be done late since only after assignAddresses
|
||||
// we know the size of the sections.
|
||||
removeEmptyPTLoad();
|
||||
|
||||
if (!Config->OFormatBinary)
|
||||
assignFileOffsets();
|
||||
else
|
||||
assignFileOffsetsBinary();
|
||||
|
||||
setPhdrs();
|
||||
|
||||
if (Config->Relocatable) {
|
||||
for (OutputSectionCommand *Cmd : OutputSectionCommands)
|
||||
Cmd->Sec->Addr = 0;
|
||||
} else {
|
||||
Script->assignAddresses(Phdrs, OutputSectionCommands);
|
||||
|
||||
// Remove empty PT_LOAD to avoid causing the dynamic linker to try to mmap a
|
||||
// 0 sized region. This has to be done late since only after assignAddresses
|
||||
// we know the size of the sections.
|
||||
removeEmptyPTLoad();
|
||||
|
||||
if (!Config->OFormatBinary)
|
||||
assignFileOffsets();
|
||||
else
|
||||
assignFileOffsetsBinary();
|
||||
|
||||
setPhdrs();
|
||||
fixPredefinedSymbols();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue