From 33bb52fb4e77c96f77dee32dea89fa32869ce015 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 7 Aug 2008 19:57:28 +0000 Subject: bfd/ * elf32-mips.c (elf_backend_hide_symbol): Delete. * elfn32-mips.c (elf_backend_hide_symbol): Likewise. * elf64-mips.c (elf_backend_hide_symbol): Likewise. * elfxx-mips.h (elf_backend_hide_symbol): Likewise. * elfxx-mips.c (mips_elf_link_hash_entry): Remove "forced_local" and add "needs_lazy_stub". (mips_elf_link_hash_newfunc): Update accordingly. (mips_elf_link_hash_table): Remove "computed_got_sizes" and add "lazy_stub_count". (_bfd_mips_elf_link_hash_table_create): Update accordingly. (mips_elf_output_extsym): Use hd->needs_lazy_stub to detect cases where a lazy stub is being used. (mips_elf_sort_hash_table_f): Use h->root.forced_local instead of h->forced_local. (mips_elf_record_global_got_symbol): Use _bfd_elf_link_hash_hide_symbol instead of _bfd_mips_elf_hide_symbol. Do not increment local_gotno here. (mips_elf_allocate_dynamic_relocations): Move before new first use. (mips_elf_check_recreate_got, mips_elf_recreate_got): New functions. (mips_elf_resolve_final_got_entries): Move earlier in file. Make at most two passes over the hash table. Use mips_elf_check_recreate_got to see if there are any indirect or warning entries and mips_elf_recreate_got to create a new GOT without them. Return a boolean success value. (mips_elf_count_forced_local_got_entries): New function. (mips_elf_make_got_per_bfd): Check h->root.forced_local instead of h->forced_local. (mips_elf_set_global_got_offset): Likewise. (mips_elf_set_no_stub): Replace with... (mips_elf_forbid_lazy_stubs): ...this new function. (mips_elf_resolve_final_got_entry): Delete. (mips_elf_multi_got): Fix formatting. Use mips_elf_forbid_lazy_stubs instead of mips_elf_set_no_stub. Move the code that sets global offsets and allocates dynamic relocations from the main _bfd_mips_elf_size_dynamic_sections loop to here. (_bfd_mips_elf_adjust_dynamic_symbol): Do not allocate room in .MIPS.stubs here; just set hmips->needs_lazy_stub and increment htab->lazy_stub_count. (_bfd_mips_elf_always_size_sections): Move the stub-estimation code to mips_elf_estimate_stub_size and the GOT-sizing code to mips_elf_lay_out_got. Do not call these functions here. (mips_elf_estimate_stub_size): New function, split out from _bfd_mips_elf_always_size_sections. Call mips_elf_resolve_final_got_entries earlier. Count the number of forced-local entries. Do not add stub sizes to loadable_size; after this patch, the stub sizes are already included in the main estimate. Allocate dynamic relocations here rather than in the main _bfd_mips_elf_size_dynamic_sections loop. (mips_elf_estimate_stub_size): New function, split out from _bfd_mips_elf_always_size_sections. (mips_elf_allocate_lazy_stub): New function. (mips_elf_lay_out_lazy_stubs): Likewise. (_bfd_mips_elf_size_dynamic_sections): Call mips_elf_estimate_stub_size, mips_elf_lay_out_got and mips_elf_lay_out_lazy_stubs. Do not handle the allocation of sreldyn specially. (_bfd_mips_elf_hide_symbol): Delete. ld/testsuite/ * ld-mips-elf/tlsdyn-o32-2.got, ld-mips-elf/tlsdyn-o32-3.got, ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-3.d: Change the GOT layout as follows: BEFORE AFTER +0x08 %call16(__tls_get_addr) %call16(__tls_get_addr) +0x0c %tlsldm(tlsbin_ld) %gottprel(tlsvar_ie) +0x10 " " %tlsgd(tlsvar_gd) +0x14 %tlsgd(tlsvar_gd) " " +0x18 " " %tlsgd(tlsbin_gd) +0x1c %gottprel(tlsvar_ie) " " +0x20 %tlsgd(tlsbin_gd) %tlsldm(tlsbin_ld) +0x24 " " " " +0x28 %gottprel(tlsbin_ie) %gottprel(tlsbin_ie) --- ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d | 16 ++++++++-------- ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got | 14 +++++++------- ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d | 16 ++++++++-------- ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got | 14 +++++++------- 4 files changed, 30 insertions(+), 30 deletions(-) (limited to 'ld/testsuite/ld-mips-elf') diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d index bf803c88..e1f76b5 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d @@ -12,19 +12,19 @@ Disassembly of section .text: .*: 03a0f021 move s8,sp .*: afbc0000 sw gp,0\(sp\) .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848030 addiu a0,gp,-32720 + .*: 27848028 addiu a0,gp,-32728 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848024 addiu a0,gp,-32732 + .*: 27848020 addiu a0,gp,-32736 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 2784801c addiu a0,gp,-32740 + .*: 27848030 addiu a0,gp,-32720 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) @@ -36,7 +36,7 @@ Disassembly of section .text: .*: 8f838038 lw v1,-32712\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 - .*: 8f83802c lw v1,-32724\(gp\) + .*: 8f83801c lw v1,-32740\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 .*: 7c02283b rdhwr v0,\$5 @@ -62,19 +62,19 @@ Disassembly of section .text: .*: 03a0f021 move s8,sp .*: afbc0000 sw gp,0\(sp\) .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848030 addiu a0,gp,-32720 + .*: 27848028 addiu a0,gp,-32728 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848024 addiu a0,gp,-32732 + .*: 27848020 addiu a0,gp,-32736 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 2784801c addiu a0,gp,-32740 + .*: 27848030 addiu a0,gp,-32720 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) @@ -86,7 +86,7 @@ Disassembly of section .text: .*: 8f838038 lw v1,-32712\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 - .*: 8f83802c lw v1,-32724\(gp\) + .*: 8f83801c lw v1,-32740\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 .*: 7c02283b rdhwr v0,\$5 diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got index e397b2f..c5516c5 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got @@ -4,16 +4,16 @@ DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE \*ABS\* -10000040 R_MIPS_TLS_DTPMOD32 tlsbin_gd -10000044 R_MIPS_TLS_DTPREL32 tlsbin_gd -10000034 R_MIPS_TLS_DTPMOD32 tlsvar_gd -10000038 R_MIPS_TLS_DTPREL32 tlsvar_gd -1000003c R_MIPS_TLS_TPREL32 tlsvar_ie +10000038 R_MIPS_TLS_DTPMOD32 tlsbin_gd +1000003c R_MIPS_TLS_DTPREL32 tlsbin_gd +10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd +10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd +1000002c R_MIPS_TLS_TPREL32 tlsvar_ie 10000048 R_MIPS_TLS_TPREL32 tlsbin_ie Contents of section .got: - 10000020 00000000 80000000 0040053c 00000001 .* + 10000020 00000000 80000000 0040053c 00000000 .* 10000030 00000000 00000000 00000000 00000000 .* - 10000040 00000000 00000000 00000000 00000000 .* + 10000040 00000001 00000000 00000000 00000000 .* 10000050 00000000 00000000 .* diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d index 4a3a0e1..27db816 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d @@ -12,19 +12,19 @@ Disassembly of section .text: .*: 03a0f021 move s8,sp .*: afbc0000 sw gp,0\(sp\) .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848030 addiu a0,gp,-32720 + .*: 27848028 addiu a0,gp,-32728 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848024 addiu a0,gp,-32732 + .*: 27848020 addiu a0,gp,-32736 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 2784801c addiu a0,gp,-32740 + .*: 27848030 addiu a0,gp,-32720 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) @@ -36,7 +36,7 @@ Disassembly of section .text: .*: 8f838038 lw v1,-32712\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 - .*: 8f83802c lw v1,-32724\(gp\) + .*: 8f83801c lw v1,-32740\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 .*: 7c02283b rdhwr v0,\$5 @@ -58,19 +58,19 @@ Disassembly of section .text: .*: 03a0f021 move s8,sp .*: afbc0000 sw gp,0\(sp\) .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848030 addiu a0,gp,-32720 + .*: 27848028 addiu a0,gp,-32728 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 27848024 addiu a0,gp,-32732 + .*: 27848020 addiu a0,gp,-32736 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) .*: 00000000 nop .*: 8f998018 lw t9,-32744\(gp\) - .*: 2784801c addiu a0,gp,-32740 + .*: 27848030 addiu a0,gp,-32720 .*: 0320f809 jalr t9 .*: 00000000 nop .*: 8fdc0000 lw gp,0\(s8\) @@ -82,7 +82,7 @@ Disassembly of section .text: .*: 8f838038 lw v1,-32712\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 - .*: 8f83802c lw v1,-32724\(gp\) + .*: 8f83801c lw v1,-32740\(gp\) .*: 00000000 nop .*: 00621821 addu v1,v1,v0 .*: 7c02283b rdhwr v0,\$5 diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got index fe77221..54f491e 100644 --- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got +++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got @@ -4,16 +4,16 @@ DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE \*ABS\* -10000040 R_MIPS_TLS_DTPMOD32 tlsbin_gd -10000044 R_MIPS_TLS_DTPREL32 tlsbin_gd -10000034 R_MIPS_TLS_DTPMOD32 tlsvar_gd -10000038 R_MIPS_TLS_DTPREL32 tlsvar_gd -1000003c R_MIPS_TLS_TPREL32 tlsvar_ie +10000038 R_MIPS_TLS_DTPMOD32 tlsbin_gd +1000003c R_MIPS_TLS_DTPREL32 tlsbin_gd +10000030 R_MIPS_TLS_DTPMOD32 tlsvar_gd +10000034 R_MIPS_TLS_DTPREL32 tlsvar_gd +1000002c R_MIPS_TLS_TPREL32 tlsvar_ie 10000048 R_MIPS_TLS_TPREL32 tlsbin_ie Contents of section .got: - 10000020 00000000 80000000 004005ec 00000001 .* + 10000020 00000000 80000000 004005ec 00000000 .* 10000030 00000000 00000000 00000000 00000000 .* - 10000040 00000000 00000000 00000000 00000000 .* + 10000040 00000001 00000000 00000000 00000000 .* 10000050 00000000 00000000 .* -- cgit v1.1