forked from OSchip/llvm-project
ELF2: Call OutputSection::finalize() from createSections.
Previously, we did this in assignAddresses(), but finalization was not part of assigning addresses, so this is a better place. llvm-svn: 249842
This commit is contained in:
parent
ffd132878a
commit
af311c1d01
|
@ -485,6 +485,12 @@ template <class ELFT> void Writer<ELFT>::createSections() {
|
||||||
|
|
||||||
// Fill the DynStrTab early.
|
// Fill the DynStrTab early.
|
||||||
Out<ELFT>::Dynamic->finalize();
|
Out<ELFT>::Dynamic->finalize();
|
||||||
|
|
||||||
|
// Fix each section's header (e.g. sh_size, sh_link, etc.)
|
||||||
|
for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
|
||||||
|
Out<ELFT>::StrTab->add(Sec->getName());
|
||||||
|
Sec->finalize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
|
@ -524,9 +530,6 @@ template <class ELFT> void Writer<ELFT>::assignAddresses() {
|
||||||
FileHeaderPHDR.Header.p_align = Target->getPageSize();
|
FileHeaderPHDR.Header.p_align = Target->getPageSize();
|
||||||
|
|
||||||
for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
|
for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
|
||||||
Out<ELFT>::StrTab->add(Sec->getName());
|
|
||||||
Sec->finalize();
|
|
||||||
|
|
||||||
if (Sec->getSize()) {
|
if (Sec->getSize()) {
|
||||||
uintX_t Flags = toPHDRFlags(Sec->getFlags());
|
uintX_t Flags = toPHDRFlags(Sec->getFlags());
|
||||||
ProgramHeader<ELFT> *Last = PHDRs.back();
|
ProgramHeader<ELFT> *Last = PHDRs.back();
|
||||||
|
|
Loading…
Reference in New Issue