diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2013-05-29 16:22:14 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@linux-mips.org> | 2013-05-29 16:22:14 +0000 |
commit | d6101ac20076846ff5092444691d502fd689c886 (patch) | |
tree | bc8ed8a04d7189c55c1d9b6b3966300002064ba8 /gas | |
parent | 95e34fb4f43f5cc57c48d4799c5c59d7dcf6c2a2 (diff) | |
download | binutils-gdb-d6101ac20076846ff5092444691d502fd689c886.tar.gz |
gas/
* write.c (resolve_reloc_expr_symbols): On REL targets don't
convert relocs who have no relocatable field either. Rephrase
the conditional so that the PC-relative check is only applied
for REL targets.
gas/testsuite/
* gas/mips/jalr3.d: New test.
* gas/mips/jalr3-n32.d: New test.
* gas/mips/jalr3-n64.d: New test.
* gas/mips/jalr3.s: New test source.
* gas/mips/mips.exp: Run the new tests.
ld/testsuite/
* ld-mips-elf/jalr3.dd: New test.
* ld-mips-elf/jalr3.ld: New test linker script.
* ld-mips-elf/mips-elf.exp: Run the new test.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/jalr3-n32.d | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/jalr3-n64.d | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/jalr3.d | 11 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/jalr3.s | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips.exp | 10 | ||||
-rw-r--r-- | gas/write.c | 7 |
8 files changed, 81 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index b9731852961..eb53b16105f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2013-05-29 Maciej W. Rozycki <macro@codesourcery.com> + + * write.c (resolve_reloc_expr_symbols): On REL targets don't + convert relocs who have no relocatable field either. Rephrase + the conditional so that the PC-relative check is only applied + for REL targets. + 2013-05-28 Chao-ying Fu <Chao-ying.Fu@imgtec.com> * config/tc-mips.c (macro) <ld>: Don't use $zero for address diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 3b3c3762ca0..76c9de8ef2e 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-05-29 Maciej W. Rozycki <macro@codesourcery.com> + + * gas/mips/jalr3.d: New test. + * gas/mips/jalr3-n32.d: New test. + * gas/mips/jalr3-n64.d: New test. + * gas/mips/jalr3.s: New test source. + * gas/mips/mips.exp: Run the new tests. + 2013-05-28 Cary Coutant <ccoutant@google.com> * gas/cris/rd-dw2-1.d: Adjust expected output. diff --git a/gas/testsuite/gas/mips/jalr3-n32.d b/gas/testsuite/gas/mips/jalr3-n32.d new file mode 100644 index 00000000000..6d9525ef08a --- /dev/null +++ b/gas/testsuite/gas/mips/jalr3-n32.d @@ -0,0 +1,5 @@ +#objdump: -r -j .text +#name: MIPS JALR reloc (n32) +#as: -n32 +#source: jalr3.s +#dump: jalr3.d diff --git a/gas/testsuite/gas/mips/jalr3-n64.d b/gas/testsuite/gas/mips/jalr3-n64.d new file mode 100644 index 00000000000..001e7f1f8d1 --- /dev/null +++ b/gas/testsuite/gas/mips/jalr3-n64.d @@ -0,0 +1,15 @@ +#objdump: -r -j .text +#name: MIPS JALR reloc (n64) +#as: -64 +#source: jalr3.s + +.*: +file format .*mips.* + +RELOCATION RECORDS FOR \[\.text\]: +OFFSET TYPE VALUE +0000000000000000 R_MIPS_JALR \$bar +0000000000000000 R_MIPS_NONE \*ABS\* +0000000000000000 R_MIPS_NONE \*ABS\* +0000000000000008 R_MIPS_JALR \$bar +0000000000000008 R_MIPS_NONE \*ABS\* +0000000000000008 R_MIPS_NONE \*ABS\* diff --git a/gas/testsuite/gas/mips/jalr3.d b/gas/testsuite/gas/mips/jalr3.d new file mode 100644 index 00000000000..73ce08a9c7a --- /dev/null +++ b/gas/testsuite/gas/mips/jalr3.d @@ -0,0 +1,11 @@ +#objdump: -r -j .text +#name: MIPS JALR reloc (o32) +#as: -32 +#source: jalr3.s + +.*: +file format .*mips.* + +RELOCATION RECORDS FOR \[\.text\]: +OFFSET TYPE VALUE +00000000 R_MIPS_JALR \$bar +00000008 R_MIPS_JALR \$bar diff --git a/gas/testsuite/gas/mips/jalr3.s b/gas/testsuite/gas/mips/jalr3.s new file mode 100644 index 00000000000..6d3ae9f442e --- /dev/null +++ b/gas/testsuite/gas/mips/jalr3.s @@ -0,0 +1,21 @@ + .text + + .set $bar, bar + + .globl foo + .ent foo +foo: + .reloc 1f, R_MIPS_JALR, $bar +1: jalr $25 + .reloc 1f, R_MIPS_JALR, $bar +1: jr $25 + .end foo + + .ent bar +bar: + j $31 + .end bar + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 1107fb6b7bc..a7b85ddb512 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -974,6 +974,16 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "tls-o32" run_dump_test "tls-relw" run_dump_test "jalr2" + run_dump_test_arches "jalr3" [mips_arch_list_matching mips1 \ + !micromips] + if $has_newabi { + run_dump_test_arches "jalr3-n32" \ + [mips_arch_list_matching mips3 \ + !micromips] + run_dump_test_arches "jalr3-n64" \ + [mips_arch_list_matching mips3 \ + !micromips] + } run_dump_test_arches "aent" [mips_arch_list_matching mips1] diff --git a/gas/write.c b/gas/write.c index 22e68c5ec8f..745abe66d8d 100644 --- a/gas/write.c +++ b/gas/write.c @@ -722,9 +722,10 @@ resolve_reloc_expr_symbols (void) unless it has enough bits to cover the whole address space. */ if (S_IS_LOCAL (sym) && !symbol_section_p (sym) - && !(howto->partial_inplace - && howto->pc_relative - && howto->src_mask != addr_mask)) + && (sec->use_rela_p + || (howto->partial_inplace + && (!howto->pc_relative + || howto->src_mask == addr_mask)))) { asection *symsec = S_GET_SEGMENT (sym); if (!(((symsec->flags & SEC_MERGE) != 0 |