diff options
author | Matthew Fortune <matthew.fortune@mips.com> | 2019-05-13 17:03:19 -0700 |
---|---|---|
committer | Faraz Shahbazker <fshahbazker@wavecomp.com> | 2019-05-21 09:22:28 -0700 |
commit | 3734320dc054bd9f6632607e9e5c901c57450791 (patch) | |
tree | 09ada7b6ef14bf220ce429dbd2d4a0dcd0faa654 /ld/emultempl | |
parent | 6467207116c66ff2c58f8bc35cb15b2596f5c457 (diff) | |
download | gdb-3734320dc054bd9f6632607e9e5c901c57450791.zip gdb-3734320dc054bd9f6632607e9e5c901c57450791.tar.gz gdb-3734320dc054bd9f6632607e9e5c901c57450791.tar.bz2 |
[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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r-- | ld/emultempl/mipself.em | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em index d9eeef3..ec908d7 100644 --- a/ld/emultempl/mipself.em +++ b/ld/emultempl/mipself.em @@ -44,6 +44,7 @@ static bfd *stub_bfd; static bfd_boolean insn32; static bfd_boolean ignore_branch_isa; +static bfd_boolean compact_branches; static void mips_after_parse (void) @@ -216,7 +217,10 @@ mips_create_output_section_statements (void) ${gnu_target}); if (is_mips_elf (link_info.output_bfd)) - _bfd_mips_elf_init_stubs (&link_info, mips_add_stub_section); + { + _bfd_mips_elf_compact_branches (&link_info, compact_branches); + _bfd_mips_elf_init_stubs (&link_info, mips_add_stub_section); + } } /* This is called after we have merged the private data of the input bfds. */ @@ -269,7 +273,9 @@ enum OPTION_INSN32 = 301, OPTION_NO_INSN32, OPTION_IGNORE_BRANCH_ISA, - OPTION_NO_IGNORE_BRANCH_ISA + OPTION_NO_IGNORE_BRANCH_ISA, + OPTION_COMPACT_BRANCHES, + OPTION_NO_COMPACT_BRANCHES }; ' @@ -278,6 +284,8 @@ PARSE_AND_LIST_LONGOPTS=' { "no-insn32", no_argument, NULL, OPTION_NO_INSN32 }, { "ignore-branch-isa", no_argument, NULL, OPTION_IGNORE_BRANCH_ISA }, { "no-ignore-branch-isa", no_argument, NULL, OPTION_NO_IGNORE_BRANCH_ISA }, + { "compact-branches", no_argument, NULL, OPTION_COMPACT_BRANCHES }, + { "no-compact-branches", no_argument, NULL, OPTION_NO_COMPACT_BRANCHES }, ' PARSE_AND_LIST_OPTIONS=' @@ -295,6 +303,12 @@ PARSE_AND_LIST_OPTIONS=' --no-ignore-branch-isa Reject invalid branch relocations requiring\n\ an ISA mode switch\n" )); + fprintf (file, _("\ + --compact-branches Generate compact branches/jumps for MIPS R6\n" + )); + fprintf (file, _("\ + --no-compact-branches Generate delay slot branches/jumps for MIPS R6\n" + )); ' PARSE_AND_LIST_ARGS_CASES=' @@ -313,6 +327,14 @@ PARSE_AND_LIST_ARGS_CASES=' case OPTION_NO_IGNORE_BRANCH_ISA: ignore_branch_isa = FALSE; break; + + case OPTION_COMPACT_BRANCHES: + compact_branches = TRUE; + break; + + case OPTION_NO_COMPACT_BRANCHES: + compact_branches = FALSE; + break; ' LDEMUL_AFTER_PARSE=mips_after_parse |