diff options
author | Alan Modra <amodra@gmail.com> | 2015-01-20 17:19:15 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-01-20 19:52:42 +1030 |
commit | 23283c1be02de06666e4d934b1fc499c0d72f9c2 (patch) | |
tree | cd6bc9ab21af319ff36832b68394d152bd3e1946 /ld/emulparams | |
parent | 3e2b0f3116a46c8a9a6ffbcb5ae4847b6601467a (diff) | |
download | gdb-23283c1be02de06666e4d934b1fc499c0d72f9c2.zip gdb-23283c1be02de06666e4d934b1fc499c0d72f9c2.tar.gz gdb-23283c1be02de06666e4d934b1fc499c0d72f9c2.tar.bz2 |
Reorder more powerpc64 sections for -z relro
This moves .got too, which requires .sdata and .sbss to move with it,
because these sections share addressing via the toc pointer and with
small-model code must be within a 16-bit signed offset. .plt, .iplt
and .branch_lt must also be moved since they are addressed via a
32-bit offset from the toc pointer, and we might have a very large
.data section.
This change means we may have some bss style sections before the data
segment, necessitating another PT_LOAD header. Also, since _edata is
defined at the end of the data segment it's possible with an empty
.data to have _edata at the end of .plt which looks a little unusual
since .plt is a bss style section. That should only happen rarely in
real world binaries, but does occur in the ld testsuite.
ld/
* emulparams/elf64ppc.sh (BSS_PLT): Don't define.
(OTHER_READWRITE_SECTIONS): Move .branch_lt to..
(OTHER_RELRO_SECTIONS_2): ..here.
(DATA_GOT, SEPARATE_GOTPLT, DATA_SDATA, DATA_PLT,
PLT_BEFORE_GOT): Define.
* scripttempl/elf.sc: Handle DATA_SDATA and DATA_GOT/DATA_PLT/
PLT_BEFORE_GOT combination.
(DATA_GOT, SDATA_GOT): Don't define if either is already defined.
ld/testsuite/
* ld-powerpc/ambiguousv1.d,
* ld-powerpc/ambiguousv1b.d,
* ld-powerpc/ambiguousv2.d,
* ld-powerpc/ambiguousv2b.d,
* ld-powerpc/elfv2exe.d,
* ld-powerpc/elfv2so.d,
* ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r,
* ld-powerpc/tlstocso.r: Update.
Diffstat (limited to 'ld/emulparams')
-rw-r--r-- | ld/emulparams/elf64ppc.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh index 556fbf5..89fc699 100644 --- a/ld/emulparams/elf64ppc.sh +++ b/ld/emulparams/elf64ppc.sh @@ -15,7 +15,6 @@ unset SBSS_END_SYMBOLS unset OTHER_END_SYMBOLS unset OTHER_RELRO_SECTIONS OTHER_TEXT_SECTIONS="*(.sfpr .glink)" -BSS_PLT= OTHER_BSS_SYMBOLS=" .tocbss ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.tocbss)}" OTHER_PLT_RELOC_SECTIONS=" @@ -36,7 +35,16 @@ OTHER_GOT_RELOC_SECTIONS=" .rela.toc ${RELOCATING-0} : { *(.rela.toc) } .rela.branch_lt ${RELOCATING-0} : { *(.rela.branch_lt) }" OTHER_READWRITE_SECTIONS=" - .toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) } - .branch_lt ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.branch_lt) }" + .toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) }" OTHER_RELRO_SECTIONS_2=" - .opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) }" + .opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) } + .branch_lt ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.branch_lt) }" +# Put .got before .data +DATA_GOT=" " +# Always make .got read-only after relocation +SEPARATE_GOTPLT=0 +# Also put .sdata before .data +DATA_SDATA=" " +# and .plt/.iplt before .data +DATA_PLT= +PLT_BEFORE_GOT=" " |