mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 14:53:32 +08:00
3734320dc0
Add a new option to get the linker to emit PLTs that use compact branches instead of delay slot branches. bfd/ * elfxx-mips.c (LA25_BC): New macro. (mips_elf_link_hash_table)<compact_branches>: New field. (STUB_JALRC): New macro. (mipsr6_o32_exec_plt0_entry_compact): New array. (mipsr6_n32_exec_plt0_entry_compact): Likewise. (mipsr6_n64_exec_plt0_entry_compact): Likewise. (mipsr6_exec_plt_entry_compact): Likewise. (mips_elf_create_la25_stub): Use BC instead of J for stubs when compact_branches is true. (_bfd_mips_elf_finish_dynamic_symbol): Choose the compact PLT for MIPSR6 with compact_branches. Do not reorder the compact branches PLT. Switch the lazy stub for MIPSR6 with compact_branches to use JALRC. (mips_finish_exec_plt): Choose the compact PLT0 for MIPSR6 when compact_branches is true. (_bfd_mips_elf_compact_branches): New function. * elfxx-mips.h (_bfd_mips_elf_compact_branches): New prototype. ld/ * emultempl/mipself.em (compact_branches): New static variable. (mips_create_output_section_statements): Call _bfd_mips_elf_compact_branches. (PARSE_AND_LIST_PROLOGUE): Add OPTION_COMPACT_BRANCHES and OPTION_NO_COMPACT_BRANCHES. (PARSE_AND_LIST_LONGOPTS): Add compact-branches, no-compact-branches. (PARSE_AND_LIST_OPTIONS): Add --compact-branches, --no-compact-branches. (PARSE_AND_LIST_ARGS_CASES): Handle the above. * ld.texinfo: Document --compact-branches, --no-compact-branches. * testsuite/ld-mips-elf/pic-and-nonpic-1-r6.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-r6.nd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.gd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1a-r6.s: New test source. * testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
37 lines
801 B
Plaintext
37 lines
801 B
Plaintext
# GOT layout:
|
|
#
|
|
# -32752: lazy resolution function
|
|
# -32748: reserved for module pointer
|
|
# -32744: the GOT page entry
|
|
# -32740: foo's GOT entry
|
|
# -32736: ext's GOT entry
|
|
|
|
.*
|
|
|
|
Disassembly of section \.text:
|
|
|
|
00000800 <foo>:
|
|
800: 3c1c0001 lui gp,0x1
|
|
804: 279c7bf0 addiu gp,gp,31728
|
|
808: 0399e021 addu gp,gp,t9
|
|
80c: 8f99801c lw t9,-32740\(gp\)
|
|
810: 8f828018 lw v0,-32744\(gp\)
|
|
814: 24420000 addiu v0,v0,0
|
|
818: d8190000 jrc t9
|
|
|
|
0000081c <bar>:
|
|
81c: 3c1c0001 lui gp,0x1
|
|
820: 279c7bd4 addiu gp,gp,31700
|
|
824: 0399e021 addu gp,gp,t9
|
|
828: 8f998020 lw t9,-32736\(gp\)
|
|
82c: d8190000 jrc t9
|
|
#...
|
|
Disassembly of section \.MIPS\.stubs:
|
|
|
|
00000c00 <_MIPS_STUBS_>:
|
|
c00: 8f998010 lw t9,-32752\(gp\)
|
|
c04: 03e07825 move t7,ra
|
|
c08: 2418[0-9a-f]+ li t8,[0-9]+
|
|
c0c: f8190000 jalrc t9
|
|
\.\.\.
|