aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-07-20 11:35:03 +0000
committerNick Clifton <nickc@redhat.com>2005-07-20 11:35:03 +0000
commit157e7bd196cc83495a38f37b1528d2505d554b2e (patch)
tree4c78dde5569e0909da71fd5c2970c505d6a7bf4c /gas
parent6c76e4a1c9743ba5ea19e5b11f71e1a39e73d291 (diff)
downloadgdb-157e7bd196cc83495a38f37b1528d2505d554b2e.zip
gdb-157e7bd196cc83495a38f37b1528d2505d554b2e.tar.gz
gdb-157e7bd196cc83495a38f37b1528d2505d554b2e.tar.bz2
Add support for a 32bit PC relative reloc
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-m32r.c14
-rw-r--r--gas/testsuite/ChangeLog10
-rw-r--r--gas/testsuite/gas/m32r/error.exp1
-rw-r--r--gas/testsuite/gas/m32r/rel32-err.s10
-rw-r--r--gas/testsuite/gas/m32r/rel32-pic.d13
-rw-r--r--gas/testsuite/gas/m32r/rel32-pic.s12
-rw-r--r--gas/testsuite/gas/m32r/rel32.d13
-rw-r--r--gas/testsuite/gas/m32r/rel32.exp6
-rw-r--r--gas/testsuite/gas/m32r/rel32.s12
10 files changed, 95 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 24a86dc..3cac97b 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-20 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+ * config/tc-m32r.c (tc_gen_reloc): Check BFD_RELOC_32_PCREL and
+ BFD_RELOC_16_PCREL to Support R_M32R_REL32.
+
2005-07-18 Nick Clifton <nickc@redhat.com>
* configure.tgt: Restore alpha ordering to list of arches.
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index 5f17337..978f373 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -2258,6 +2258,17 @@ tc_gen_reloc (asection * section, fixS * fixP)
reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
+
+ if (fixP->fx_pcrel)
+ {
+ if (fixP->fx_r_type == BFD_RELOC_32)
+ fixP->fx_r_type = BFD_RELOC_32_PCREL;
+ else if (fixP->fx_r_type == BFD_RELOC_16)
+ {
+ fixP->fx_r_type = BFD_RELOC_16_PCREL;
+ bfd_set_error (bfd_error_bad_value);
+ }
+ }
code = fixP->fx_r_type;
if (pic_code)
@@ -2327,7 +2338,8 @@ printf(" => %s\n",reloc->howto->name);
/* Use fx_offset for these cases. */
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
+ || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+ || fixP->fx_r_type == BFD_RELOC_32_PCREL)
reloc->addend = fixP->fx_offset;
else if ((!pic_code
&& code != BFD_RELOC_M32R_26_PLTREL)
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 6added2..c8176e4 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2005-07-20 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+ * gas/m32r/rel32.exp: New file.
+ * gas/m32r/rel32.s: New file.
+ * gas/m32r/rel32.d: New file.
+ * gas/m32r/rel32-pic.s: New file.
+ * gas/m32r/rel32-pic.d: New file.
+ * gas/m32r/rel32-err.s: New file.
+ * gas/m32r/error.exp: Added rel32-err.
+
2005-07-18 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Add suffix.
diff --git a/gas/testsuite/gas/m32r/error.exp b/gas/testsuite/gas/m32r/error.exp
index 17807c1..11c15d5 100644
--- a/gas/testsuite/gas/m32r/error.exp
+++ b/gas/testsuite/gas/m32r/error.exp
@@ -10,6 +10,7 @@ if [istarget m32r-*-*] {
dg-runtest "$srcdir/$subdir/interfere.s" "" ""
dg-runtest "$srcdir/$subdir/outofrange.s" "" ""
dg-runtest "$srcdir/$subdir/parallel.s" "" ""
+ dg-runtest "$srcdir/$subdir/rel32-err.s" "" ""
dg-finish
diff --git a/gas/testsuite/gas/m32r/rel32-err.s b/gas/testsuite/gas/m32r/rel32-err.s
new file mode 100644
index 0000000..fe8784e
--- /dev/null
+++ b/gas/testsuite/gas/m32r/rel32-err.s
@@ -0,0 +1,10 @@
+
+; { dg-do assemble { target m32r-*-* } }
+
+ .text
+ nop
+ nop
+bar:
+ .section .text2
+ .2byte bar - . ; { dg-error "can't export reloc type 11" }
+ .byte bar - . ; { dg-error "can\'t export reloc type 7" }
diff --git a/gas/testsuite/gas/m32r/rel32-pic.d b/gas/testsuite/gas/m32r/rel32-pic.d
new file mode 100644
index 0000000..9a27fe9
--- /dev/null
+++ b/gas/testsuite/gas/m32r/rel32-pic.d
@@ -0,0 +1,13 @@
+#as: -KPIC
+#objdump: -r
+#name: rel32-pic
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[.text2\]:
+OFFSET TYPE VALUE
+00000000 R_M32R_REL32 .text\+0x00000004
+00000008 R_M32R_REL32 .text\+0x00000008
+0000000c R_M32R_REL32 .text
+
+
diff --git a/gas/testsuite/gas/m32r/rel32-pic.s b/gas/testsuite/gas/m32r/rel32-pic.s
new file mode 100644
index 0000000..488c3ea
--- /dev/null
+++ b/gas/testsuite/gas/m32r/rel32-pic.s
@@ -0,0 +1,12 @@
+ .text
+ nop
+ nop
+bar:
+ .section .text2
+ .4byte bar - .
+label:
+ nop
+ nop
+ .4byte bar - label
+ .4byte bar - label2
+label2:
diff --git a/gas/testsuite/gas/m32r/rel32.d b/gas/testsuite/gas/m32r/rel32.d
new file mode 100644
index 0000000..abfe136
--- /dev/null
+++ b/gas/testsuite/gas/m32r/rel32.d
@@ -0,0 +1,13 @@
+#as:
+#objdump: -r
+#name: rel32
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[.text2\]:
+OFFSET TYPE VALUE
+00000000 R_M32R_REL32 .text\+0x00000004
+00000008 R_M32R_REL32 .text\+0x00000008
+0000000c R_M32R_REL32 .text
+
+
diff --git a/gas/testsuite/gas/m32r/rel32.exp b/gas/testsuite/gas/m32r/rel32.exp
new file mode 100644
index 0000000..1866217
--- /dev/null
+++ b/gas/testsuite/gas/m32r/rel32.exp
@@ -0,0 +1,6 @@
+# M32R R_M32R_REL32 testcases
+
+if [istarget m32r*-*-*] {
+ run_dump_test "rel32"
+ run_dump_test "rel32-pic"
+}
diff --git a/gas/testsuite/gas/m32r/rel32.s b/gas/testsuite/gas/m32r/rel32.s
new file mode 100644
index 0000000..488c3ea
--- /dev/null
+++ b/gas/testsuite/gas/m32r/rel32.s
@@ -0,0 +1,12 @@
+ .text
+ nop
+ nop
+bar:
+ .section .text2
+ .4byte bar - .
+label:
+ nop
+ nop
+ .4byte bar - label
+ .4byte bar - label2
+label2: