]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
This patch causes local GOT entries addressed via a 16-bit index to
authorKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 17 Apr 2014 13:13:44 +0000 (14:13 +0100)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 17 Apr 2014 13:40:08 +0000 (14:40 +0100)
commitcb22ccf4110d82441b8d56875419d871f10f3f8f
tree0b8eaab30333307e9e072bdd29dde106094a69b9
parent7ce16bd4c4d5e6f6a48ca7fcf532720fec0406bf
This patch causes local GOT entries addressed via a 16-bit index to
be placed towards the front of local GOT space, while entries addressed
via a 32-bit index are placed towards the rear.

Provided that there are fewer than ~16K local GOT entries addressed via
a 16-bit index in total, this should eliminate any relocation overflows
caused by such GOT entries being allocated beyond the addressable range.

bfd/
* elfxx-mips.c (struct mips_got_info): Delete assigned_gotno
field.  Add assigned_low_gotno and assigned_high_gotno fields.
(mips_elf_create_local_got_entry): Update out-of-space condition.
Set index of new GOT entry to assigned_low_gotno if required by
the current relocation, else set it to assigned_high_gotno.
(mips_elf_set_global_gotidx): Replace uses of assigned_gotno
with assigned_low_gotno.
(mips_elf_multi_got): Initialize assigned_low_gotno and
assigned_high_gotno in secondary GOTs.  Use assigned_low_gotno
in place of assigned_gotno when handling global GOT entries.
(mips_elf_lay_out_got): Initialize assigned_low_gotno and
assigned_high_gotno.
(_bfd_mips_elf_finish_dynamic_sections): Account for a possible
gap in the middle of local GOT space.

ld/testsuite/
* ld-mips-elf/elf-rel-xgot-n32.d: Update for new GOT layout.
* ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise.
bfd/ChangeLog
bfd/elfxx-mips.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/elf-rel-xgot-n32-embed.d
ld/testsuite/ld-mips-elf/elf-rel-xgot-n32.d
ld/testsuite/ld-mips-elf/elf-rel-xgot-n64-embed.d
ld/testsuite/ld-mips-elf/elf-rel-xgot-n64-linux.d
ld/testsuite/ld-mips-elf/elf-rel-xgot-n64.d