diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2016-05-24 13:54:31 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2016-05-24 14:11:50 +0100 |
commit | 44d3da2338157ad7acfd6facbcfb38ed6ec94fa1 (patch) | |
tree | 58d2bfee6de323bf7aa36f75d3906119d18ade52 /ld/testsuite | |
parent | 4512dafa508c4b148996f2d67222a82dd018cdd3 (diff) | |
download | gdb-44d3da2338157ad7acfd6facbcfb38ed6ec94fa1.zip gdb-44d3da2338157ad7acfd6facbcfb38ed6ec94fa1.tar.gz gdb-44d3da2338157ad7acfd6facbcfb38ed6ec94fa1.tar.bz2 |
MIPS/GAS: Treat local jump relocs the same no matter if REL or RELA
Do not convert jump relocs against local MIPS16 or microMIPS symbols to
refer to a section symbol instead even on RELA targets, as it makes it
impossible for the linker to make a JAL to JALX conversion based on ISA
symbol annotation, breaking regular and compressed MIPS interlinking.
gas/
* config/tc-mips.c (mips_fix_adjustable): Also return 0 for
jump relocations against MIPS16 or microMIPS symbols on RELA
targets.
* testsuite/gas/mips/jalx-local.d: New test.
* testsuite/gas/mips/jalx-local-n32.d: New test.
* testsuite/gas/mips/jalx-local-n64.d: New test.
* testsuite/gas/mips/jalx-local.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* testsuite/ld-mips-elf/jalx-local.d: New test.
* testsuite/ld-mips-elf/jalx-local-n32.d: New test.
* testsuite/ld-mips-elf/jalx-local-n64.d: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-mips-elf/jalx-local-n32.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/jalx-local-n64.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/jalx-local.d | 26 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/mips-elf.exp | 3 |
4 files changed, 41 insertions, 0 deletions
diff --git a/ld/testsuite/ld-mips-elf/jalx-local-n32.d b/ld/testsuite/ld-mips-elf/jalx-local-n32.d new file mode 100644 index 0000000..b5615b9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/jalx-local-n32.d @@ -0,0 +1,6 @@ +#name: MIPS JALX to local symbol (n32) +#source: ../../../gas/testsuite/gas/mips/jalx-local.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: jalx-local.d diff --git a/ld/testsuite/ld-mips-elf/jalx-local-n64.d b/ld/testsuite/ld-mips-elf/jalx-local-n64.d new file mode 100644 index 0000000..3a18363 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/jalx-local-n64.d @@ -0,0 +1,6 @@ +#name: MIPS JALX to local symbol (n64) +#source: ../../../gas/testsuite/gas/mips/jalx-local.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: jalx-local.d diff --git a/ld/testsuite/ld-mips-elf/jalx-local.d b/ld/testsuite/ld-mips-elf/jalx-local.d new file mode 100644 index 0000000..0453858 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/jalx-local.d @@ -0,0 +1,26 @@ +#name: MIPS JALX to local symbol +#source: ../../../gas/testsuite/gas/mips/jalx-local.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> f300 0408 jalx 0*1c001020 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> f300 0408 jalx 0*1c001020 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 0000 0000 nop +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 77000400 jalx 0*1c001000 <.*> +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 77000400 jalx 0*1c001000 <.*> +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 741f2e2..615f173 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -169,9 +169,12 @@ if { $linux_gnu } { } run_dump_test "jalx-addend" [list [list ld $abi_ldflags(o32)]] +run_dump_test "jalx-local" [list [list ld $abi_ldflags(o32)]] if $has_newabi { run_dump_test "jalx-addend-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "jalx-local-n32" [list [list ld $abi_ldflags(n32)]] run_dump_test "jalx-addend-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "jalx-local-n64" [list [list ld $abi_ldflags(n64)]] } # Test multi-got link. We only do this on GNU/Linux because it requires |