summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r--lld/ELF/OutputSections.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index dc3e68f1249..17bd9a64d4d 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -189,9 +189,11 @@ template <class ELFT> void DynamicSection<ELFT>::finalize() {
unsigned NumEntries = 0;
if (RelaDynSec.hasRelocs()) {
++NumEntries; // DT_RELA / DT_REL
- ++NumEntries; // DT_RELASZ / DTRELSZ
+ ++NumEntries; // DT_RELASZ / DT_RELSZ
+ ++NumEntries; // DT_RELAENT / DT_RELENT
}
++NumEntries; // DT_SYMTAB
+ ++NumEntries; // DT_SYMENT
++NumEntries; // DT_STRTAB
++NumEntries; // DT_STRSZ
++NumEntries; // DT_HASH
@@ -227,12 +229,20 @@ template <class ELFT> void DynamicSection<ELFT>::writeTo(uint8_t *Buf) {
P->d_tag = IsRela ? DT_RELASZ : DT_RELSZ;
P->d_un.d_val = RelaDynSec.getSize();
++P;
+
+ P->d_tag = IsRela ? DT_RELAENT : DT_RELENT;
+ P->d_un.d_val = IsRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel);
+ ++P;
}
P->d_tag = DT_SYMTAB;
P->d_un.d_ptr = DynSymSec.getVA();
++P;
+ P->d_tag = DT_SYMENT;
+ P->d_un.d_ptr = sizeof(Elf_Sym);
+ ++P;
+
P->d_tag = DT_STRTAB;
P->d_un.d_ptr = DynStrSec.getVA();
++P;
OpenPOWER on IntegriCloud