[PATCH] D59240: ELF: Don't add .dynamic strings to .dynstr early.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 12 13:57:30 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355977: ELF: Don't add .dynamic strings to .dynstr early. (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59240?vs=190202&id=190329#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59240/new/
https://reviews.llvm.org/D59240
Files:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/verneed.s
Index: lld/trunk/test/ELF/verneed.s
===================================================================
--- lld/trunk/test/ELF/verneed.s
+++ lld/trunk/test/ELF/verneed.s
@@ -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: }
Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -1205,25 +1205,6 @@
// 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 @@
// 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;
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -1792,7 +1792,6 @@
finalizeSynthetic(In.ShStrTab);
finalizeSynthetic(In.StrTab);
finalizeSynthetic(In.VerDef);
- finalizeSynthetic(In.DynStrTab);
finalizeSynthetic(In.Got);
finalizeSynthetic(In.MipsGot);
finalizeSynthetic(In.IgotPlt);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59240.190329.patch
Type: text/x-patch
Size: 3221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190312/ea090df8/attachment.bin>
More information about the llvm-commits
mailing list