Browse Source
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.binutils-2_27-branch
12 changed files with 195 additions and 7 deletions
@ -0,0 +1,29 @@ |
|||
#objdump: -dr --prefix-addresses --show-raw-insn |
|||
#name: MIPS JALX local symbol relocation (n32) |
|||
#as: -n32 -march=from-abi |
|||
#source: jalx-local.s |
|||
|
|||
.*: +file format .*mips.* |
|||
|
|||
Disassembly of section \.text: |
|||
\.\.\. |
|||
[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero |
|||
[0-9a-f]+ <[^>]*> f400 0000 jal 00000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 \.text\+0x1020 |
|||
[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero |
|||
[0-9a-f]+ <[^>]*> f000 0000 jalx 00000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 \.text\+0x1020 |
|||
[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]+ <[^>]*> 0c000000 jal 00000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MIPS_26 foo |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
[0-9a-f]+ <[^>]*> 74000000 jalx 00000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MIPS_26 foo |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
\.\.\. |
|||
@ -0,0 +1,37 @@ |
|||
#objdump: -dr --prefix-addresses --show-raw-insn |
|||
#name: MIPS JALX local symbol relocation (n64) |
|||
#as: -64 -march=from-abi |
|||
#source: jalx-local.s |
|||
|
|||
.*: +file format .*mips.* |
|||
|
|||
Disassembly of section \.text: |
|||
\.\.\. |
|||
[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero |
|||
[0-9a-f]+ <[^>]*> f400 0000 jal 0000000000000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 \.text\+0x1020 |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0x1020 |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0x1020 |
|||
[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero |
|||
[0-9a-f]+ <[^>]*> f000 0000 jalx 0000000000000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 \.text\+0x1020 |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0x1020 |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0x1020 |
|||
[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]+ <[^>]*> 0c000000 jal 0000000000000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MIPS_26 foo |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\* |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\* |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
[0-9a-f]+ <[^>]*> 74000000 jalx 0000000000000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MIPS_26 foo |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\* |
|||
[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\* |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
\.\.\. |
|||
@ -0,0 +1,28 @@ |
|||
#objdump: -dr --prefix-addresses --show-raw-insn |
|||
#name: MIPS JALX local symbol relocation |
|||
#as: -32 |
|||
|
|||
.*: +file format .*mips.* |
|||
|
|||
Disassembly of section \.text: |
|||
\.\.\. |
|||
[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero |
|||
[0-9a-f]+ <[^>]*> f400 0810 jal 00001020 <bar> |
|||
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 \.text |
|||
[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero |
|||
[0-9a-f]+ <[^>]*> f000 0408 jalx 00001020 <bar> |
|||
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 \.text |
|||
[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]+ <[^>]*> 0c000000 jal 00000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MIPS_26 foo |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
[0-9a-f]+ <[^>]*> 74000000 jalx 00000000 <foo-0x1000> |
|||
[ ]*[0-9a-f]+: R_MIPS_26 foo |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra |
|||
[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero |
|||
\.\.\. |
|||
@ -0,0 +1,33 @@ |
|||
.text |
|||
.set noreorder |
|||
.space 0x1000 |
|||
|
|||
.align 4 |
|||
.set micromips |
|||
.ent foo |
|||
foo: |
|||
nor $0, $0 |
|||
jal bar |
|||
nor $0, $0 |
|||
jalx bar |
|||
nor $0, $0 |
|||
jalr $0, $ra |
|||
nor $0, $0 |
|||
.end foo |
|||
|
|||
.align 4 |
|||
.set nomicromips |
|||
.ent bar |
|||
bar: |
|||
nor $0, $0 |
|||
jal foo |
|||
nor $0, $0 |
|||
jalx foo |
|||
nor $0, $0 |
|||
jalr $0, $ra |
|||
nor $0, $0 |
|||
.end bar |
|||
|
|||
# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... |
|||
.align 4, 0 |
|||
.space 16 |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
\.\.\. |
|||
Loading…
Reference in new issue