From c224138d88196fe7cabce4fe554c10a1520f5a4f Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 14 Nov 2007 20:46:15 +0000 Subject: bfd/ 2007-09-18 Richard Sandiford * elfxx-mips.c (mips_got_page_range): New structure. (mips_got_page_entry): Likewise. (mips_got_info): Add page_gotno and got_page_entries fields. (mips_elf_got_per_bfd_arg): Add max_pages field. Delete primary_count and current_count fields. (mips_got_page_entry_hash, mips_got_page_entry_eq): New functions. (mips_elf_pages_for_range, mips_elf_record_got_page_entry): Likewise. (mips_elf_get_got_for_bfd): New function, split out from mips_elf_make_got_per_bfd. Initialize the page_gotno and got_page_entries fields when creating a new GOT structure. (mips_elf_make_got_pages_per_bfd): New function. (mips_elf_merge_got_with): New function, split out from mips_elf_make_got_per_bfd. Merge page entries as well as non-page entries. Use the minimum of max_pages and the sum of the page_gotnos to estimate the number of page entries. (mips_elf_merge_gots): Use the minimum of max_pages and the bfd's page_gotno to estimate the number of page entries. Use the above functions. (mips_elf_multi_got): Add page entries as well as non-page entries to the individual per-bfd GOTs. Initialize got_per_bfd_arg.max_pages. Initialize the page_gotno and got_page_entries fields when creating a new primary GOT. Use the minimum of pages and page_gotno when adding the number of pages entries to local_gotno. (mips_elf_create_got_section): Initialize the page_gotno and got_page_entries fields of the GOT structure. (mips_elf_rel_relocation_p, mips_elf_read_rel_addend) (mips_elf_add_lo16_rel_addend, mips_elf_get_section_contents): New functions, split out from... (_bfd_mips_elf_relocate_section): ...here. (_bfd_mips_elf_check_relocs): Record GOT page entries too. (_bfd_mips_relax_section): Use mips_elf_get_section_contents. (_bfd_mips_elf_always_size_sections): Use the smaller of the loadable_size- and page_gotno-derived estimates. ld/testsuite/ 2007-09-18 Richard Sandiford Joseph Myers * ld-mips-elf/got-page-1.d, ld-mips-elf/got-page-1.s, * ld-mips-elf/got-page-2.d, ld-mips-elf/got-page-2.s, * ld-mips-elf/got-page-3.d, ld-mips-elf/got-page-3a.s, * ld-mips-elf/got-page-3b.s, ld-mips-elf/got-page-3c.s, * ld-mips-elf/got-page-1.ld: New tests. * ld-mips-elf/mips-elf.exp: Run them. * ld-mips-elf/multi-got-1.d, ld-mips-elf/multi-got-no-shared.d, * ld-mips-elf/tls-hidden2-got.d, ld-mips-elf/tls-hidden2.d, * ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got, * ld-mips-elf/tls-hidden3.r, ld-mips-elf/tls-hidden4.got, * ld-mips-elf/tls-hidden4.r, ld-mips-elf/tls-multi-got-1.d, * ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1.r, * ld-mips-elf/tlsbin-o32.d, ld-mips-elf/tlsbin-o32.got, * ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-1.got, * ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.got, * ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-3.got, * ld-mips-elf/tlsdyn-o32.d, ld-mips-elf/tlsdyn-o32.got, * ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-o32-ver.got, * ld-mips-elf/tlslib-o32.d, ld-mips-elf/tlslib-o32.got: Update for GOT allocation changes. --- ld/testsuite/ld-mips-elf/got-page-1.s | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 ld/testsuite/ld-mips-elf/got-page-1.s (limited to 'ld/testsuite/ld-mips-elf/got-page-1.s') diff --git a/ld/testsuite/ld-mips-elf/got-page-1.s b/ld/testsuite/ld-mips-elf/got-page-1.s new file mode 100644 index 0000000..976a522 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/got-page-1.s @@ -0,0 +1,46 @@ + # See below. + lw $4,%got(foo+0x120000)($gp) + addiu $4,$4,%lo(foo+0x120000) + + # 2 pages + lw $4,%got(foo-0x8000)($gp) + addiu $4,$4,%lo(foo-0x8000) + lw $4,%got(foo+0x800)($gp) + addiu $4,$4,%lo(foo+0x8000) + + # 2 pages + lw $4,%got(foo-0x1000000)($gp) + addiu $4,$4,%lo(foo-0x1000000) + lw $4,%got(foo-0xffffff)($gp) + addiu $4,$4,%lo(foo-0xffffff) + + # 1 page + lw $4,%got(foo+0x120000)($gp) + addiu $4,$4,%lo(foo+0x120000) + + # 5 pages + lw $4,%got(bar)($gp) + addiu $4,$4,%lo(bar) + lw $4,%got(bar+0x20000)($gp) + addiu $4,$4,%lo(bar+0x20000) + lw $4,%got(bar+0x40000)($gp) + addiu $4,$4,%lo(bar+0x40000) + lw $4,%got(bar+0x30000)($gp) + addiu $4,$4,%lo(bar+0x30000) + lw $4,%got(bar+0x10000)($gp) + addiu $4,$4,%lo(bar+0x10000) + lw $4,%got(bar+0x38000)($gp) + addiu $4,$4,%lo(bar+0x38000) + lw $4,%got(bar+0x14000)($gp) + addiu $4,$4,%lo(bar+0x14000) + lw $4,%got(bar+0x2c000)($gp) + addiu $4,$4,%lo(bar+0x2c000) + lw $4,%got(bar+0x02000)($gp) + addiu $4,$4,%lo(bar+0x02000) + + .section .bss.foo,"aw",@nobits + .fill 0x800000 +foo: .fill 0x800000 + + .section .bss.bar,"aw",@nobits +bar: .fill 0xc00000 -- cgit v1.1