From cb22ccf4110d82441b8d56875419d871f10f3f8f Mon Sep 17 00:00:00 2001 From: Kwok Cheung Yeung Date: Thu, 17 Apr 2014 14:13:44 +0100 Subject: 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'bfd/ChangeLog') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bf71f22..b15ff5c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2014-04-17 Kwok Cheung Yeung + + * 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. + 2014-04-17 Alan Modra PR 16846 -- cgit v1.1