[PATCH] D16799: [ELF] Finalize .dynamic section at the end
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 01:12:01 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259478: [ELF] Finalize .dynamic section at the end (authored by atanasyan).
Changed prior to commit:
http://reviews.llvm.org/D16799?vs=46623&id=46625#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16799
Files:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/mips-relocs.s
Index: lld/trunk/test/ELF/mips-relocs.s
===================================================================
--- lld/trunk/test/ELF/mips-relocs.s
+++ lld/trunk/test/ELF/mips-relocs.s
@@ -4,13 +4,13 @@
# RUN: ld.lld -shared %t-be.o -o %t-be.so
# RUN: llvm-objdump -t %t-be.so | FileCheck %s
# RUN: llvm-objdump -s %t-be.so | FileCheck -check-prefix=BE %s
-# RUN: llvm-readobj -relocations %t-be.so | FileCheck -check-prefix=REL %s
+# RUN: llvm-readobj -r -dynamic-table %t-be.so | FileCheck -check-prefix=REL %s
# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o
# RUN: ld.lld -shared %t-el.o -o %t-el.so
# RUN: llvm-objdump -t %t-el.so | FileCheck %s
# RUN: llvm-objdump -s %t-el.so | FileCheck -check-prefix=EL %s
-# RUN: llvm-readobj -relocations %t-el.so | FileCheck -check-prefix=REL %s
+# RUN: llvm-readobj -r -dynamic-table %t-el.so | FileCheck -check-prefix=REL %s
# REQUIRES: mips
@@ -49,3 +49,8 @@
# REL-NEXT: 0x30008 R_MIPS_REL32 - 0x0
# REL-NEXT: }
# REL-NEXT: ]
+
+# REL: DynamicSection [
+# REL: Tag Type Name/Value
+# REL: 0x00000012 RELSZ 16 (bytes)
+# REL: 0x00000013 RELENT 8 (bytes)
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -967,11 +967,17 @@
if (isOutputDynamic())
Out<ELFT>::DynSymTab->finalize();
- // Fill other section headers. The dynamic string table in finalized
- // once the .dynamic finalizer has added a few last strings.
+ // Fill other section headers. The dynamic table is finalized
+ // at the end because some tags like RELSZ depend on result
+ // of finalizing other sections. The dynamic string table is
+ // finalized once the .dynamic finalizer has added a few last
+ // strings. See DynamicSection::finalize()
for (OutputSectionBase<ELFT> *Sec : OutputSections)
- if (Sec != Out<ELFT>::DynStrTab)
+ if (Sec != Out<ELFT>::DynStrTab && Sec != Out<ELFT>::Dynamic)
Sec->finalize();
+
+ if (isOutputDynamic())
+ Out<ELFT>::Dynamic->finalize();
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16799.46625.patch
Type: text/x-patch
Size: 2158 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160202/d841381b/attachment.bin>
More information about the llvm-commits
mailing list