2002-09-27 Kaz Kojima <kkojima@rr.iij4u.or.jp>
authorDaniel Jacobowitz <drow@false.org>
Sat, 28 Sep 2002 00:41:27 +0000 (00:41 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sat, 28 Sep 2002 00:41:27 +0000 (00:41 +0000)
        * config/tc-sh.c (sh_force_relocation): Return 0 for
        some PC relative relocations when not relaxing.
        * testsuite/gas/sh/pcrel2.s: New.
        * testsuite/gas/sh/pcrel2.d: New.
        * testsuite/gas/sh/basic.exp: Add pcrel2 test.

gas/ChangeLog
gas/config/tc-sh.c
gas/testsuite/ChangeLog
gas/testsuite/gas/sh/basic.exp
gas/testsuite/gas/sh/pcrel2.d [new file with mode: 0644]
gas/testsuite/gas/sh/pcrel2.s [new file with mode: 0644]

index 705ef535ce6ae0e17986f4f4c46b739e7b8a6fd9..641f7c1e3f0b9d8f6ff6ef29242711e2b9482a96 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-27  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * config/tc-sh.c (sh_force_relocation): Return 0 for
+       some PC relative relocations when not relaxing.
+
 2002-09-26  Jakub Jelinek  <jakub@redhat.com>
 
        * config/tc-i386.c (tc_i386_fix_adjustable): Add x86-64 TLS relocs.
index b74dc56b22fdafc59d2461fa1d743124b578e359..be5e8578325adaeef0b9c046e10c5a9c43fc5920 100644 (file)
@@ -3219,6 +3219,18 @@ int
 sh_force_relocation (fix)
      fixS *fix;
 {
+  /* These relocations can't make it into a DSO, so no use forcing
+     them for global symbols.  */
+  if (! sh_relax
+      && (fix->fx_r_type == BFD_RELOC_SH_PCDISP8BY2
+         || fix->fx_r_type == BFD_RELOC_SH_PCDISP12BY2
+         || fix->fx_r_type == BFD_RELOC_SH_PCRELIMM8BY2
+         || fix->fx_r_type == BFD_RELOC_SH_PCRELIMM8BY4
+         || fix->fx_r_type == BFD_RELOC_8_PCREL
+         || fix->fx_r_type == BFD_RELOC_SH_SWITCH16
+         || fix->fx_r_type == BFD_RELOC_SH_SWITCH32))
+    return 0;
+
   if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
       || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
       || fix->fx_r_type == BFD_RELOC_SH_LOOP_START
index 11566bef747846b3e78e4ed667e4c662cefc1a43..1336d7d692164f131eeea0287f9331036712cafa 100644 (file)
@@ -1,3 +1,9 @@
+2002-09-27  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * gas/sh/pcrel2.s: New.
+       * gas/sh/pcrel2.d: New.
+       * gas/sh/basic.exp: Add pcrel2 test.
+
 2002-09-27  Jason Thorpe  <thorpej@wasabisystems.com>
 
        * gas/vax/elf-rel.[ds]: New test.
index b3815c17cf937c695a3090e6cf97e4f5aabaa7cc..dade86aca2fcc9cfee7ce28b1b23d8ba10fea10b 100644 (file)
@@ -129,6 +129,8 @@ if [istarget sh*-*-*] then {
        run_dump_test "dsp"
 
        run_dump_test "pcrel"
+
+       run_dump_test "pcrel2"
     }
 
     if {[istarget sh*-*elf] || [istarget sh*-linux*]} then {
diff --git a/gas/testsuite/gas/sh/pcrel2.d b/gas/testsuite/gas/sh/pcrel2.d
new file mode 100644 (file)
index 0000000..9b363af
--- /dev/null
@@ -0,0 +1,5 @@
+#as: -big
+#objdump: -r
+#name: PC-relative loads
+
+.*:     file format .*sh.*
diff --git a/gas/testsuite/gas/sh/pcrel2.s b/gas/testsuite/gas/sh/pcrel2.s
new file mode 100644 (file)
index 0000000..5a34111
--- /dev/null
@@ -0,0 +1,17 @@
+       .text
+
+       .p2align 2
+code:
+       bf      foo
+       mov.l   bar, r0
+       mov.w   bar, r0
+       .globl  foo
+foo:
+       bra     foo
+       nop
+       .align 2
+       .globl  bar
+bar:
+       .long   . - foo
+       .word   . - foo
+       .byte   . - foo
This page took 0.033998 seconds and 4 git commands to generate.