diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-09-30 21:57:53 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-09-30 21:57:53 +0000 |
| commit | 2dfd74f758da92d7c2ebd7590722092001d5622e (patch) | |
| tree | 2b03172069934831300868114ae604fdea3e0e06 /lld/ELF/OutputSections.cpp | |
| parent | f1eca25b16b9016b2c058559106ec233ceabfa5c (diff) | |
| download | bcm5719-llvm-2dfd74f758da92d7c2ebd7590722092001d5622e.tar.gz bcm5719-llvm-2dfd74f758da92d7c2ebd7590722092001d5622e.zip | |
ELF2: Add DT_REL{,A}ENT and DT_SYMENT.
According to the ELF specification, these dynamic array entries are mandatory.
http://reviews.llvm.org/D13303
llvm-svn: 248952
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 12 |
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; |

