aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
AgeCommit message (Collapse)AuthorFilesLines
2018-07-11MIPS/BFD: Fix TLS relocation resolution for regular executablesMaciej W. Rozycki1-2/+2
Correct an issue with commit 0f20cc3522e7 ("TLS support for MIPS"), <https://sourceware.org/ml/binutils/2005-02/msg00607.html>, where a condition used to determine whether to use a dynamic symbol for GD, LD and IE TLS dynamic relocations against a symbol that has been defined locally has been incorrectly reversed. It's executables rather than dynamic shared objects where no symbol is required, because such symbols cannot be preempted and therefore their values (thread pointer offsets) are fixed at the static link time as is the associated module ID of the main executable, so the original condition should have been `shared' instead of `!shared'. This wrong condition was then later converted from `!shared' to `!bfd_link_pic', with commit 0e1862bb401f ("Add output_type to bfd_link_info"). Use the correct `bfd_link_dll' condition then, and adjust code for the dynamic symbol index possibly being -1 as with symbols that have been forced local, removing unnecessary dynamic relocations from dynamic regular executables. PIE executables are unaffected as the existing condition excluded them by chance due to the conversion mentioned above. Adjust test cases accordingly. bfd/ * elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather than `!bfd_link_pic' in determining the dynamic symbol index. Avoid the index of -1. (mips_elf_initialize_tls_slots): Likewise. Flatten code by moving `dyn' to the beginning of the function block. ld/ * testsuite/ld-mips-elf/tlsdyn-o32.d: Update test for dynamic relocation removal. * testsuite/ld-mips-elf/tlsdyn-o32.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-1.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
2017-11-28PR22471, undefined reference to linker-defined symbolsAlan Modra1-2/+2
This patch processes linker script assignment statements before ld opens DT_NEEDED libraries, in order to define symbols like __bss_start that might also be defined by a library, falsely triggering an error about "DSO missing from command line". The initial value won't be correct when assigning a symbol from dot, and I make no attempt to handle all expressions. For example, an assignment like "_start_foo = ADDR (.foo)" isn't valid until sections are laid out, so won't define _start_foo early. What's here should be enough for most common scripts, and hopefully won't perturb fragile scripts. bfd/ PR 22471 * elflink.c (_bfd_elf_merge_symbol): Allow weak symbols to override early passes over linker script symbols. * linker.c (_bfd_generic_link_add_one_symbol): Allow symbols to override early passes over linker script symbols. Clear ldscript_def on symbol definitions. ld/ PR 22471 * ldexp.c (struct definedness_hash_entry): Delete "by_script". Make "iteration" an 8-bit field, and update mask in all uses. (definedness_newfunc): Don't init "by_script". (update_definedness): Test ldscript_def rather than by_script. (is_sym_value): Likewise. (fold_name <DEFINED>): Return a result for first phase. Test ldscript_def. (fold_name <NAME>): Return a result for first phase. * ldlang.c (open_input_bfds): Process all assignments, not just defsym. (lang_process): Increment lang_statement_iteration before open_input_bfds. * testsuite/ld-mips-elf/tlsdyn-o32-1.d: Adjust for larger .dynsym. * testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
2015-08-12[MIPS] Map 'move' to 'or'.Simon Dardis1-6/+6
The MIPS assembly idiom 'move' now maps to the 'or' machine instruction. This change affects microMIPS, MIPS32, MIPS64. 2015-08-12 Simon Dardis <simon.dardis@imgtec.com> opcodes/ * micromips-opc.c (micromips_opcodes): Re-order table so that move based on 'or' is first. * mips-opc.c (mips_builtin_opcodes): Ditto. bfd/ * elfxx-mips.c (STUB_MOVE): Change to use 'or' only. (mips_o32_exec_plt0_entry, mips_n32_exec_plt0_entry, mips_n64_exec_plt0_entry, micromips_insn32_o32_exec_plt0_entry): Update to use 'or' instead of 'addu/daddu'. (_bfd_mips_elf_finish_dynamic_symbol): Update usage of STUB_MOVE. (move_insns_32): Reorder table. gas/ * config/tc-mips.c (move_register): Change to use 'or' only. (s_cpload, s_cpsetup, s_cprestore, s_cpreturn): Update to use or for move. gas/testsuite/ * gas/mips/elf-rel23.d: Update test. * gas/mips/elf-rel23.d: Ditto. * gas/mips/elf-rel23a.d: Ditto. * gas/mips/elf-rel23b.d: Ditto. * gas/mips/elf_e_flags1.d: Ditto. * gas/mips/elf_e_flags2.d: Ditto. * gas/mips/elf_e_flags3.d: Ditto. * gas/mips/elf_e_flags4.d: Ditto. * gas/mips/loc-swap-dis.d: Ditto. * gas/mips/micromips-insn32.d: Ditto. * gas/mips/micromips-noinsn32.d: Ditto. * gas/mips/micromips-trap.d: Ditto. * gas/mips/micromips.d: Ditto. * gas/mips/mips-abi32-pic.d: Ditto. * gas/mips/mips-abi32.d: Ditto. * gas/mips/mips-gp32-fp32-pic.d: Ditto. * gas/mips/mips-gp32-fp32.d: Ditto. * gas/mips/mips-gp32-fp64-pic.d: Ditto. * gas/mips/mips-gp32-fp64.d: Ditto. * gas/mips/mips-gp64-fp32-pic.d: Ditto. * gas/mips/mips-gp64-fp32.d: Ditto. * gas/mips/mips-gp64-fp64-pic.d: Ditto. * gas/mips/mips-gp64-fp64.d: Ditto. * gas/mips/mipsr6@loc-swap-dis.d: Ditto. * gas/mips/tls-o32.d: Ditto. * gas/mips/uld2-eb.d: Ditto. * gas/mips/uld2-el.d: Ditto. * gas/mips/ulw2-eb-ilocks.d: Ditto. * gas/mips/ulw2-eb.d: Ditto. * gas/mips/ulw2-el-ilocks.d: Ditto. * gas/mips/ulw2-el.d: Ditto. * gas/mips/move.d: New test. * gas/mips/move.s: Ditto. * gas/mips/micromips32-move.d: Ditto. * gas/mips/micromips32-move.s: Ditto. * gas/mips/mips.exp: Run the new tests. gold/ * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64, lazy_stub_normal_1, lazy_stub_normal_1_n64, lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big, lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64, lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big, lazy_stub_micromips32_big_n64): Update to use 'or' for move instead of 'addu/daddu'. ld/testsuite/ * ld-mips-elf/compressed-plt-1-n32-mips16.od: Update test. * ld-mips-elf/compressed-plt-1-n32-umips.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-mips16-got.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-mips16-only.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-mips16-word.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-mips16.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-se.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-umips-got.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-umips-word.od: Ditto. * ld-mips-elf/compressed-plt-1-o32-umips.od: Ditto. * ld-mips-elf/jalx-2.dd: Ditto. * ld-mips-elf/mips16-pic-3.dd: Ditto. * ld-mips-elf/pic-and-nonpic-3a.dd: Ditto. * ld-mips-elf/pic-and-nonpic-3b.dd: Ditto. * ld-mips-elf/pic-and-nonpic-5b.dd: Ditto. * ld-mips-elf/pic-and-nonpic-6-n32.dd: Ditto. * ld-mips-elf/pic-and-nonpic-6-o32.dd: Ditto. * ld-mips-elf/stub-dynsym-1-10000.d: Ditto. * ld-mips-elf/stub-dynsym-1-2fe80.d: Ditto. * ld-mips-elf/stub-dynsym-1-7fff.d: Ditto. * ld-mips-elf/stub-dynsym-1-8000.d: Ditto. * ld-mips-elf/stub-dynsym-1-fff0.d: Ditto. * ld-mips-elf/tlsbin-o32.d: Ditto. * ld-mips-elf/tlsdyn-o32-1.d: Ditto. * ld-mips-elf/tlsdyn-o32-2.d: Ditto. * ld-mips-elf/tlsdyn-o32-3.d: Ditto. * ld-mips-elf/tlsdyn-o32.d: Ditto. * ld-mips-elf/tlslib-o32.d: Ditto.
2015-06-26Add support for DT_MIPS_RLD_MAP_REL.Matthew Fortune1-2/+2
This tag makes it possible to access the debug map when debugging position independent executables. bfd/ * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable instead of !shared to indicate an application vs shared library. (_bfd_mips_elf_size_dynamic_sections): Likewise. (_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL. (_bfd_mips_elf_get_target_dtag): Likewise. binutils/ * readelf.c (get_mips_dynamic_type): Handle DT_MIPS_RLD_MAP_REL. include/ * elf/mips.h (DT_MIPS_RLD_MAP_REL): New macro. ld/testsuite/ * ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag. * ld-mips-elf/pic-and-nonpic-4b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-5b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise. * ld-mips-elf/tlsdyn-o32-1.d: Likewise. * ld-mips-elf/tlsdyn-o32-1.got: Likewise. * ld-mips-elf/tlsdyn-o32-2.d: Likewise. * ld-mips-elf/tlsdyn-o32-2.got: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.got: Likewise. * ld-mips-elf/tlsdyn-o32.d: Likewise. * ld-mips-elf/tlsdyn-o32.got: Likewise. * ld-mips-elf/pie-n32.d: New file. * ld-mips-elf/pie-n64.d: Likewise. * ld-mips-elf/pie-o32.d: Likewise. * ld-mips-elf/pie.s: Likewise. * ld-mips-elf/mips-elf.exp: Add new tests.
2013-09-24bfd/Richard Sandiford1-2/+2
2013-09-24 Gregory Fong <gregory.0xf0@gmail.com> * elfxx-mips.c (mips_elf_create_got_section): Hide _GLOBAL_OFFSET_TABLE_. ld/testsuite/ 2013-09-24 Gregory Fong <gregory.0xf0@gmail.com> * ld-mips-elf/eh-frame5.d, ld-mips-elf/jalx-2.dd, ld-mips-elf/mips-elf.exp, ld-mips-elf/mips16-pic-2.ad, ld-mips-elf/mips16-pic-2.nd, ld-mips-elf/pic-and-nonpic-3a.dd, ld-mips-elf/pic-and-nonpic-3b.ad, ld-mips-elf/pic-and-nonpic-3b.dd, ld-mips-elf/pic-and-nonpic-3b.nd, ld-mips-elf/pic-and-nonpic-4b.ad, ld-mips-elf/pic-and-nonpic-4b.nd, ld-mips-elf/pic-and-nonpic-4b.rd, ld-mips-elf/pic-and-nonpic-5b.ad, ld-mips-elf/pic-and-nonpic-5b.nd, ld-mips-elf/pic-and-nonpic-6-n32.ad, ld-mips-elf/pic-and-nonpic-6-n32.dd, ld-mips-elf/pic-and-nonpic-6-n32.nd, ld-mips-elf/pic-and-nonpic-6-n64.ad, ld-mips-elf/pic-and-nonpic-6-n64.dd, ld-mips-elf/pic-and-nonpic-6-n64.nd, ld-mips-elf/pic-and-nonpic-6-o32.ad, ld-mips-elf/pic-and-nonpic-6-o32.dd, ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/rel32-n32.d, ld-mips-elf/rel32-o32.d, ld-mips-elf/rel64.d, ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1.r, 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-ver.got, ld-mips-elf/tlslib-o32.got: Update for removal of _GLOBAL_OFFSET_TABLE_ from .dynsym.
2013-02-11bfd/Richard Sandiford1-6/+6
* elfxx-mips.c (mips_got_entry): Update comments. (mips_elf_multi_got_entry_eq): Rename to... (mips_elf_got_entry_eq): ...this, deleting the old definition. (mips_elf_create_got_info): Remove master_got_p argument. Always use mips_elf_got_entry_eq. (mips_elf_bfd_got, mips_elf_multi_got, mips_elf_create_got_section): Update calls accordingly. ld/testsuite/ * 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/tls-hidden3.d, ld-mips-elf/tls-hidden3.got: Update for new hash table order.
2013-02-11bfd/Richard Sandiford1-8/+8
* elfxx-mips.c (mips_elf_multi_got_entry_hash): Rename to... (mips_elf_got_entry_hash): ...this, deleting the old version. (mips_elf_create_got_info): Use mips_elf_got_entry_hash for both types of GOT. ld/testsuite/ * ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got, ld-mips-elf/tls-multi-got-1.got, 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.d, ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-o32-ver.got: Adjust GOT layout for new got_entry hash function.
2012-08-06 * ld-mips-elf/dyn-sec64.ld: Use HIDDEN to define _gp.Maciej W. Rozycki1-2/+2
* ld-mips-elf/eh-frame5.ld: Likewise. * ld-mips-elf/got-dump-1.ld: Likewise. * ld-mips-elf/got-dump-2.ld: Likewise. * ld-mips-elf/got-page-1.ld: Likewise. * ld-mips-elf/mips-dyn.ld: Likewise. * ld-mips-elf/mips-lib.ld: Likewise. * ld-mips-elf/mips16-pic-1.ld: Likewise. * ld-mips-elf/no-shared-1.ld: Likewise. * ld-mips-elf/pic-and-nonpic-1.ld: Likewise. * ld-mips-elf/pic-and-nonpic-3a.ld: Likewise. * ld-mips-elf/pic-and-nonpic-3b.ld: Likewise. * ld-mips-elf/pic-and-nonpic-4b.ld: Likewise. * ld-mips-elf/pic-and-nonpic-5b.ld: Likewise. * ld-mips-elf/pic-and-nonpic-6.ld: Likewise. * ld-mips-elf/reloc-2.ld: Likewise. * ld-mips-elf/reloc-estimate-1.ld: Likewise. * ld-mips-elf/stub-dynsym-1.ld: Likewise. * ld-mips-elf/tls-hidden3.ld: Likewise. * ld-mips-elf/mips16-pic-2.ad: Update accordingly. * ld-mips-elf/pic-and-nonpic-3b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-4b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-5b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise. * ld-mips-elf/eh-frame5.d: Likewise. * ld-mips-elf/tlsdyn-o32-1.d: Likewise. * ld-mips-elf/tlsdyn-o32-2.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32.d: Likewise. * ld-mips-elf/pic-and-nonpic-3a.dd: Likewise. * ld-mips-elf/pic-and-nonpic-3b.dd: Likewise. * ld-mips-elf/pic-and-nonpic-6-n32.dd: Likewise. * ld-mips-elf/pic-and-nonpic-6-n64.dd: Likewise. * ld-mips-elf/pic-and-nonpic-6-o32.dd: Likewise. * ld-mips-elf/tls-multi-got-1.got: Likewise. * ld-mips-elf/tlsdyn-o32-1.got: Likewise. * ld-mips-elf/tlsdyn-o32-2.got: Likewise. * ld-mips-elf/tlsdyn-o32-3.got: Likewise. * ld-mips-elf/tlsdyn-o32.got: Likewise. * ld-mips-elf/tlslib-o32-ver.got: Likewise. * ld-mips-elf/tlslib-o32.got: Likewise. * ld-mips-elf/mips16-pic-2.nd: Likewise. * ld-mips-elf/pic-and-nonpic-1.nd: Likewise. * ld-mips-elf/pic-and-nonpic-3b.nd: Likewise. * ld-mips-elf/pic-and-nonpic-4b.nd: Likewise. * ld-mips-elf/pic-and-nonpic-5b.nd: Likewise. * ld-mips-elf/pic-and-nonpic-6-n32.nd: Likewise. * ld-mips-elf/pic-and-nonpic-6-n64.nd: Likewise. * ld-mips-elf/pic-and-nonpic-6-o32.nd: Likewise. * ld-mips-elf/tls-multi-got-1.r: Likewise. * ld-mips-elf/pic-and-nonpic-3b.rd: Likewise. * ld-mips-elf/pic-and-nonpic-4b.rd: Likewise. * ld-mips-elf/mips-elf.exp: Likewise.
2012-06-15ld/Alan Modra1-2/+2
* ldlang.h (lang_output_section_statement_type): Add after_end field. (lang_abs_symbol_at_beginning_of, lang_abs_symbol_at_end_of): Delete. (section_for_dot): Declare. * ldlang.c (lang_size_sections_1): Correct comment. (current_section): Move earlier. (current_assign, prefer_next_section): New static vars. (lang_do_assignments_1): Add found_end param. Detect _end assignment to set found_end. Set os->after_end. Set above statics. (lang_do_assignments): Adjust lang_do_assignments_1 call. Init vars. (section_for_dot): New function. (lang_set_startof): Don't make an absolute symbol. (lang_abs_symbol_at_beginning_of, lang_abs_symbol_at_end_of): Delete. * ldexp.c (new_rel_from_abs): Use section_for_dot. * emultempl/lnk960.em (symbol_at_beginning_of): New function. (symbol_at_end_of): Likewise. (lnk960_after_allocation): Use them. * scripttempl/elf.sc: Precede OTHER_GOT_SYMBOLS with . = .; and likewise before __bss_start. ld/testsuite/ Update far too many tests.
2008-08-07bfd/Richard Sandiford1-8/+8
* 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)
2008-08-06bfd/Richard Sandiford1-4/+0
* elfxx-mips.c (mips_elf_link_hash_table): Add an "sstubs" field. (_bfd_mips_elf_create_dynamic_sections): Use it to cache the stubs section. Don't check whether the section already exists. (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->sstubs. (_bfd_mips_elf_finish_dynamic_symbol): Likewise. (_bfd_mips_elf_finish_dynamic_sections): Likewise. (_bfd_mips_elf_size_dynamic_sections): Likewise. Don't add the dummy stub to an empty section. (_bfd_mips_elf_link_hash_table_create): Initialize the "sstubs" field. ld/testsuite/ * ld-mips-elf/tls-hidden3.ld: Remove the unused .MIPS.stubs section. Keep the text start address the same. * ld-mips-elf/tls-multi-got-1.got: We have removed a .MIPS.stubs section that contained only a 16-byte dummy stub. Subtract 16 from addresses to account for the change. * ld-mips-elf/tls-multi-got-1.r: Likewise. Adjust MIPS_UNREFEXTNO to account the removed section symbol. * ld-mips-elf/tlsdyn-o32-1.d: We have deleted a .MIPS.stubs section that contained only a 16-byte dummy stub. Remove it from the disassembly. * ld-mips-elf/tlsdyn-o32-2.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32.d: Likewise. * ld-mips-elf/relax-jalr-n32-shared.d: Likewise. * ld-mips-elf/relax-jalr-n64-shared.d: Likewise.
2007-11-14bfd/Richard Sandiford1-16/+16
2007-09-18 Richard Sandiford <richard@codesourcery.com> * 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 <richard@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * 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.
2007-08-13bfd/Richard Sandiford1-16/+16
* elfxx-mips.c (mips_elf_link_hash_table): Add computed_got_sizes. (mips_elf_record_global_got_symbol): Increment local_gotno for each forced-local symbol. (_bfd_mips_elf_check_relocs): Pass forced-local call symbols to mips_elf_record_global_got_symbol for VxWorks too. (_bfd_mips_elf_always_size_sections): Set computed_got_sizes to true after computing the GOT size. (_bfd_mips_elf_hide_symbol): Increase local_gotno whenever got.offset == 1. Only adjust global_gotno if computed_got_sizes. For VxWorks, add a local entry when hiding a symbol that needs a plt but has not been marked as needing a global got entry. (_bfd_mips_elf_link_hash_table_create): Set computed_got_sizes to false. ld/testsuite/ * ld-mips-elf/vxworks-forced-local-1.d, * ld-mips-elf/vxworks-forced-local-1.s, * ld-mips-elf/vxworks-forced-local-1.ver: New test. * ld-mips-elf/mips-elf.exp: Run it. * ld-mips-elf/tlsdyn-o32-2.d: Adjust for removal of unnecessary local GOT entry. * ld-mips-elf/tlsdyn-o32-2.got: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.got: Likewise. * ld-mips-elf/vxworks1-lib.dd: Likewise. * ld-mips-elf/vxworks1-lib.rd: Likewise.
2006-10-20bfd/Richard Sandiford1-2/+2
* elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Allocate a PT_NULL header for dynamic objects. (_bfd_mips_elf_modify_segment_map): Add it. ld/testsuite/ * ld-mips-elf/multi-got-1.d: Do not expect a particular address for DT_HASH. * ld-mips-elf/rel32-o32.d: Bump addresses by 0x20 to account for the extra program header. * ld-mips-elf/rel32-n32.d: Likewise. * ld-mips-elf/tlslib-o32.got: Likewise. * ld-mips-elf/tlslib-o32-hidden.got: Likewise. * ld-mips-elf/tlslib-o32-ver.got: Likewise. * ld-mips-elf/tls-multi-got-1.got: Likewise. * ld-mips-elf/tls-multi-got-1.r: Likewise. * ld-mips-elf/rel64.d: Bump addresses by 0x30 to account for the extra program header. * ld-mips-elf/tlsdyn-o32.d: Reduce the GOT offset by 32 to account for the extra program header, and thus the shorter gap between the text and data segments. * ld-mips-elf/tlsdyn-o32-1.d: Likewise. * ld-mips-elf/tlsdyn-o32-2.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32.got: Bump GOT text addresses by 0x20 to account for the extra program header. * ld-mips-elf/tlsdyn-o32-1.got: Likewise. * ld-mips-elf/tlsdyn-o32-2.got: Likewise. * ld-mips-elf/tlsdyn-o32-3.got: Likewise.
2006-10-17bfd/Alan Modra1-2/+2
* elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-02-04 * ld-mips-elf/rel32-n32.d: Adjust for changes in linker behaviour.Richard Sandiford1-18/+18
* ld-mips-elf/rel32-o32.d: Likewise. * ld-mips-elf/rel64.d: Likewise. * ld-mips-elf/tls-multi-got-1.got: Likewise. * ld-mips-elf/tls-multi-got-1.r: Likewise. * ld-mips-elf/tlsdyn-o32-1.d: Likewise. * ld-mips-elf/tlsdyn-o32-1.got: Likewise. * ld-mips-elf/tlsdyn-o32-2.d: Likewise. * ld-mips-elf/tlsdyn-o32-2.got: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.got: Likewise. * ld-mips-elf/tlsdyn-o32.d: Likewise. * ld-mips-elf/tlsdyn-o32.got: Likewise. * ld-mips-elf/tlslib-o32-hidden.got: Likewise. * ld-mips-elf/tlslib-o32-ver.got: Likewise. * ld-mips-elf/tlslib-o32.got: Likewise.
2005-03-02 * ld-mips-elf/tlsbin-o32.s, ld-mips-elf/mips-dyn.ld,Daniel Jacobowitz1-0/+104
ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32.d, ld-mips-elf/tlslib-o32.s, ld-mips-elf/mips-lib.ld, ld-mips-elf/tlsbin-o32.got, ld-mips-elf/tlsdyn-o32.d, ld-mips-elf/tlsdyn-o32.got, ld-mips-elf/tlsbin-o32.d, ld-mips-elf/tlsdyn-o32.s, ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1-1.s, ld-mips-elf/tls-multi-got-1.d, ld-mips-elf/tls-multi-got-1.r, ld-mips-elf/tls-multi-got-1-2.s, ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib.ver, ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-hidden.ver, ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-3.got, ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.s, ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-1.got, ld-mips-elf/tlsdyn-o32-2.got: New files. * ld-mips-elf/mips-elf.exp: Run the new tests.