binutils-gdb/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-r6.dd
Matthew Fortune 3734320dc0 [MIPS] Add generation of PLT entries with compact jumps for MIPS R6
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.
2019-05-21 09:22:28 -07:00

51 lines
1.1 KiB
Plaintext

.*
Disassembly of section \.text:
00041000 <\.pic\.f3>:
41000: 3c190004 lui t9,0x4
41004: 27391060 addiu t9,t9,4192
41008: c8000015 bc 41060 <f3>
4100c: 00000000 nop
00041010 <\.pic\.f2>:
41010: 3c190004 lui t9,0x4
41014: 2739104c addiu t9,t9,4172
41018: c800000c bc 4104c <f2>
\.\.\.
00041028 <\.pic\.f1>:
41028: 3c190004 lui t9,0x4
4102c: 27391030 addiu t9,t9,4144
00041030 <f1>:
41030: 3c1c0002 lui gp,0x2
41034: 279c6fd0 addiu gp,gp,28624
41038: 0399e021 addu gp,gp,t9
4103c: 0c010418 jal 41060 <f3>
41040: 00000000 nop
41044: 03e00009 jr ra
41048: 00000000 nop
0004104c <f2>:
4104c: 3c1c0002 lui gp,0x2
41050: 279c6fb4 addiu gp,gp,28596
41054: 0399e021 addu gp,gp,t9
41058: 03e00009 jr ra
4105c: 00000000 nop
00041060 <f3>:
41060: 00021400 sll v0,v0,0x10
41064: 00431021 addu v0,v0,v1
\.\.\.
00041070 <__start>:
41070: 0c01040a jal 41028 <\.pic\.f1>
41074: 00000000 nop
41078: 0c010404 jal 41010 <\.pic\.f2>
4107c: 00000000 nop
41080: 0c010400 jal 41000 <\.pic\.f3>
41084: 00000000 nop
\.\.\.