ELF: Don't add .dynamic strings to .dynstr early.
This does not appear to be necessary because StringTableSection does not need to be finalized, which also means that we can remove the call to finalizeSynthetic on .dynstr. Differential Revision: https://reviews.llvm.org/D59240 llvm-svn: 355977
This commit is contained in:
parent
1d6c47ad2b
commit
8a28673a2e
|
@ -1205,25 +1205,6 @@ DynamicSection<ELFT>::DynamicSection()
|
|||
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
|
||||
if (Config->EMachine == EM_MIPS || Config->ZRodynamic)
|
||||
this->Flags = SHF_ALLOC;
|
||||
|
||||
// Add strings to .dynstr early so that .dynstr's size will be
|
||||
// fixed early.
|
||||
for (StringRef S : Config->FilterList)
|
||||
addInt(DT_FILTER, In.DynStrTab->addString(S));
|
||||
for (StringRef S : Config->AuxiliaryList)
|
||||
addInt(DT_AUXILIARY, In.DynStrTab->addString(S));
|
||||
|
||||
if (!Config->Rpath.empty())
|
||||
addInt(Config->EnableNewDtags ? DT_RUNPATH : DT_RPATH,
|
||||
In.DynStrTab->addString(Config->Rpath));
|
||||
|
||||
for (InputFile *File : SharedFiles) {
|
||||
SharedFile<ELFT> *F = cast<SharedFile<ELFT>>(File);
|
||||
if (F->IsNeeded)
|
||||
addInt(DT_NEEDED, In.DynStrTab->addString(F->SoName));
|
||||
}
|
||||
if (!Config->SoName.empty())
|
||||
addInt(DT_SONAME, In.DynStrTab->addString(Config->SoName));
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
@ -1277,6 +1258,23 @@ static uint64_t addPltRelSz() {
|
|||
|
||||
// Add remaining entries to complete .dynamic contents.
|
||||
template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
|
||||
for (StringRef S : Config->FilterList)
|
||||
addInt(DT_FILTER, In.DynStrTab->addString(S));
|
||||
for (StringRef S : Config->AuxiliaryList)
|
||||
addInt(DT_AUXILIARY, In.DynStrTab->addString(S));
|
||||
|
||||
if (!Config->Rpath.empty())
|
||||
addInt(Config->EnableNewDtags ? DT_RUNPATH : DT_RPATH,
|
||||
In.DynStrTab->addString(Config->Rpath));
|
||||
|
||||
for (InputFile *File : SharedFiles) {
|
||||
SharedFile<ELFT> *F = cast<SharedFile<ELFT>>(File);
|
||||
if (F->IsNeeded)
|
||||
addInt(DT_NEEDED, In.DynStrTab->addString(F->SoName));
|
||||
}
|
||||
if (!Config->SoName.empty())
|
||||
addInt(DT_SONAME, In.DynStrTab->addString(Config->SoName));
|
||||
|
||||
// Set DT_FLAGS and DT_FLAGS_1.
|
||||
uint32_t DtFlags = 0;
|
||||
uint32_t DtFlags1 = 0;
|
||||
|
|
|
@ -1792,7 +1792,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
|
|||
finalizeSynthetic(In.ShStrTab);
|
||||
finalizeSynthetic(In.StrTab);
|
||||
finalizeSynthetic(In.VerDef);
|
||||
finalizeSynthetic(In.DynStrTab);
|
||||
finalizeSynthetic(In.Got);
|
||||
finalizeSynthetic(In.MipsGot);
|
||||
finalizeSynthetic(In.IgotPlt);
|
||||
|
|
|
@ -68,9 +68,9 @@
|
|||
# CHECK-NEXT: AddressAlignment: 1
|
||||
# CHECK-NEXT: EntrySize: 0
|
||||
# CHECK-NEXT: SectionData (
|
||||
# CHECK-NEXT: 0000: 00766572 6E656564 312E736F 2E300076 |.verneed1.so.0.v|
|
||||
# CHECK-NEXT: 0010: 65726E65 6564322E 736F2E30 00663100 |erneed2.so.0.f1.|
|
||||
# CHECK-NEXT: 0020: 76330066 32007632 00673100 763100 |v3.f2.v2.g1.v1.|
|
||||
# CHECK-NEXT: 0000: 00663100 7665726E 65656431 2E736F2E |.f1.verneed1.so.|
|
||||
# CHECK-NEXT: 0010: 30007633 00663200 76320067 31007665 |0.v3.f2.v2.g1.ve|
|
||||
# CHECK-NEXT: 0020: 726E6565 64322E73 6F2E3000 763100 |rneed2.so.0.v1.|
|
||||
# CHECK-NEXT: )
|
||||
# CHECK-NEXT: }
|
||||
|
||||
|
|
Loading…
Reference in New Issue