gas/
authorMaciej W. Rozycki <macro@linux-mips.org>
Wed, 29 May 2013 16:22:14 +0000 (16:22 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Wed, 29 May 2013 16:22:14 +0000 (16:22 +0000)
* 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.

12 files changed:
gas/ChangeLog
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/jalr3-n32.d [new file with mode: 0644]
gas/testsuite/gas/mips/jalr3-n64.d [new file with mode: 0644]
gas/testsuite/gas/mips/jalr3.d [new file with mode: 0644]
gas/testsuite/gas/mips/jalr3.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp
gas/write.c
ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/jalr3.dd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/jalr3.ld [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips-elf.exp

index b9731852961b2d57e87a9649f8eb14bc4d5ea62f..eb53b16105f4d14f611e5640216f9ea2677aa7c9 100644 (file)
@@ -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
index 3b3c3762ca0df40de07268d50533e64a78321662..76c9de8ef2e4b6660c1e5df60e999ccc21fbcb06 100644 (file)
@@ -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 (file)
index 0000000..6d9525e
--- /dev/null
@@ -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 (file)
index 0000000..001e7f1
--- /dev/null
@@ -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 (file)
index 0000000..73ce08a
--- /dev/null
@@ -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 (file)
index 0000000..6d3ae9f
--- /dev/null
@@ -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
index 1107fb6b7bce5c796c8c1d590fcf7319e6bd8a07..a7b85ddb5122bb63890c1251e911042f14daff6b 100644 (file)
@@ -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]
 
index 22e68c5ec8fe0474d9b2df97701298b5f06c5ee4..745abe66d8d844e45d3060d2b99ac3d960a9a291 100644 (file)
@@ -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
index cad469ce703a535258ec531dadf90397f4abb8d6..4e932aac7f94e95415a0ce5aab85b6d8271aa12a 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-29  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * 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.
+
 2013-05-21  Alan Modra  <amodra@gmail.com>
 
        PR ld/12982
diff --git a/ld/testsuite/ld-mips-elf/jalr3.dd b/ld/testsuite/ld-mips-elf/jalr3.dd
new file mode 100644 (file)
index 0000000..6b6d484
--- /dev/null
@@ -0,0 +1,14 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+
+0+000000 <foo>:
+   0:  04110003        bal     10 <\$bar>
+   4:  00000000        nop
+   8:  10000001        b       10 <\$bar>
+   c:  00000000        nop
+
+0+000010 <\$bar>:
+  10:  03e00008        jr      ra
+  14:  00000000        nop
+       \.\.\.
diff --git a/ld/testsuite/ld-mips-elf/jalr3.ld b/ld/testsuite/ld-mips-elf/jalr3.ld
new file mode 100644 (file)
index 0000000..1b86045
--- /dev/null
@@ -0,0 +1,5 @@
+ENTRY(foo)
+SECTIONS
+{
+  .text : { *(.text) }
+}
index 97e0c2ce63c741194bb74b99a433fe97161692a9..e0ddac9edf8c396e676751750c4c74813b10df9d 100644 (file)
@@ -734,3 +734,16 @@ foreach { abi } $abis {
             [list "readelf -s ehdr_start-2.nd"] \
             "ehdr_start-2-${abi}"]]
 }
+
+# R_MIPS_JALR reloc tests.
+set abis [concat o32 [expr {$has_newabi ? "n32 n64" : ""}]]
+foreach { abi } $abis {
+    run_ld_link_tests [list \
+       [list \
+           "MIPS JALR reloc test ($abi)" \
+           "$abi_ldflags($abi) -T jalr3.ld" "" \
+           "$abi_asflags($abi)" \
+           [list ../../../gas/testsuite/gas/mips/jalr3.s] \
+           [list "objdump -d jalr3.dd"] \
+           "jalr3-${abi}"]]
+}
This page took 0.031665 seconds and 4 git commands to generate.