summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-05-02 12:42:13 +0000
committerNick Clifton <nickc@redhat.com>2003-05-02 12:42:13 +0000
commite80f814e7bc1c259bad4b77ca2041fcf2d313ac6 (patch)
treefb184cf43907d6042917eecd4932a000478e39d9
parent52c2f55207e837a5b41bf816df26f3810ed45731 (diff)
downloadbinutils-redhat-e80f814e7bc1c259bad4b77ca2041fcf2d313ac6.tar.gz
Fix xstormy16's handling of pc-relative relocs against defined symbols.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-xstormy16.c8
-rw-r--r--ld/testsuite/ChangeLog8
-rw-r--r--ld/testsuite/ld-xstormy16/external.s5
-rw-r--r--ld/testsuite/ld-xstormy16/pcrel.d34
-rw-r--r--ld/testsuite/ld-xstormy16/pcrel.s31
-rw-r--r--ld/testsuite/ld-xstormy16/xstormy16.exp38
7 files changed, 128 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index fe1ef70e3c..33db4184dd 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-02 Nick Clifton <nickc@redhat.com>
+
+ * config/tc-xstormy16.c (xstormy16_md_apply_fix3): Do not bias the
+ addend with the symbol's value for pc-relative relocations against
+ a defined symbol - this will be done automatically.
+
2003-05-01 H.J. Lu <hjl@gnu.org>
* config/obj-elf.c (obj_elf_type): Accept "notype" and
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index e7b6efd96e..2c80b1a1c7 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -556,8 +556,12 @@ xstormy16_md_apply_fix3 (fixP, valueP, seg)
/* Tuck `value' away for use by tc_gen_reloc.
See the comment describing fx_addnumber in write.h.
- This field is misnamed (or misused :-). */
- fixP->fx_addnumber += value;
+ This field is misnamed (or misused :-).
+ We do not do this for pc-relative relocs against a
+ defined symbol, since it will be done for us. */
+ if ((! fixP->fx_pcrel)
+ || (fixP->fx_addsy && ! S_IS_DEFINED (fixP->fx_addsy)))
+ fixP->fx_addnumber += value;
}
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 307ffae1aa..4f0b90185a 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2003-05-02 Nick Clifton <nickc@redhat.com>
+
+ * ld-xstormy16: New directory.
+ * ld-xstormy16/xstormy16.exp: New test script.
+ * ld-xstormy16/pcrel.s: Test assembler source file.
+ * ld-xstormy16/external.s: Test assembler source file.
+ * ld-xstormy16/pcrel.d: Test expected disassembly.
+
2003-05-02 Andreas Jaeger <aj@suse.de>
* ld-elfvers/vers.exp (build_exec): Disable vers26b3 on x86-64-linux.
diff --git a/ld/testsuite/ld-xstormy16/external.s b/ld/testsuite/ld-xstormy16/external.s
new file mode 100644
index 0000000000..2907e9e4c6
--- /dev/null
+++ b/ld/testsuite/ld-xstormy16/external.s
@@ -0,0 +1,5 @@
+ .text
+ .global external
+external:
+ nop
+ \ No newline at end of file
diff --git a/ld/testsuite/ld-xstormy16/pcrel.d b/ld/testsuite/ld-xstormy16/pcrel.d
new file mode 100644
index 0000000000..b19fa5e900
--- /dev/null
+++ b/ld/testsuite/ld-xstormy16/pcrel.d
@@ -0,0 +1,34 @@
+
+.*: file format elf32-xstormy16
+
+Disassembly of section .data:
+Disassembly of section .text:
+
+00008000 <_start>:
+ 8000: 00 79 46 80 mov.w 0x0,#0x8046
+ 8004: 00 79 42 80 mov.w 0x0,#0x8042
+ 8008: 00 79 44 80 mov.w 0x0,#0x8044
+ 800c: 00 79 2c 00 mov.w 0x0,#0x2c
+ 8010: 00 79 32 00 mov.w 0x0,#0x32
+ 8014: 00 79 30 00 mov.w 0x0,#0x30
+ 8018: 2c d3 bc 0x8046
+ 801a: 26 d3 bc 0x8042
+ 801c: 26 d3 bc 0x8044
+ 801e: 24 c3 00 00 bc Rx,#0x0,0x8046
+ 8022: 1c c3 00 00 bc Rx,#0x0,0x8042
+ 8026: 1a c3 00 00 bc Rx,#0x0,0x8044
+ 802a: 00 20 18 30 bc r0,#0x0,0x8046
+ 802e: 00 20 10 30 bc r0,#0x0,0x8042
+ 8032: 00 20 0e 30 bc r0,#0x0,0x8044
+ 8036: 10 0d 0c 30 bc r0,r1,0x8046
+ 803a: 10 0d 04 30 bc r0,r1,0x8042
+ 803e: 10 0d 02 30 bc r0,r1,0x8044
+
+00008042 <global>:
+ 8042: 00 00 nop
+
+00008044 <local>:
+ 8044: 00 00 nop
+
+00008046 <external>:
+ 8046: 00 00 nop
diff --git a/ld/testsuite/ld-xstormy16/pcrel.s b/ld/testsuite/ld-xstormy16/pcrel.s
new file mode 100644
index 0000000000..6128e516e4
--- /dev/null
+++ b/ld/testsuite/ld-xstormy16/pcrel.s
@@ -0,0 +1,31 @@
+ .text
+ .global _start
+_start:
+ mov 0, # external
+ mov 0, # global
+ mov 0, # local
+
+ mov 0, # external - .
+ mov 0, # global - .
+ mov 0, # local - .
+
+ bc external
+ bc global
+ bc local
+
+ bc rx, #0, external
+ bc rx, #0, global
+ bc rx, #0, local
+
+ bc r0, #0, external
+ bc r0, #0, global
+ bc r0, #0, local
+
+ bc r0, r1, external
+ bc r0, r1, global
+ bc r0, r1, local
+ .global global
+global:
+ nop
+local:
+ nop
diff --git a/ld/testsuite/ld-xstormy16/xstormy16.exp b/ld/testsuite/ld-xstormy16/xstormy16.exp
new file mode 100644
index 0000000000..c16db917c6
--- /dev/null
+++ b/ld/testsuite/ld-xstormy16/xstormy16.exp
@@ -0,0 +1,38 @@
+# Expect script for ld-xstormy16 tests
+# Copyright (C) 2003 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# Test xstormy16 linking of pc-relative relocs. This tests the assembler and
+# tools like objdump as well as the linker.
+
+if {!([istarget "xstormy16*-*-*"]) } {
+ return
+}
+
+# Set up a list as described in ld-lib.exp
+
+set xstormy16_tests {
+ { "xstormy16 pc-relative relocs linker test"
+ ""
+ ""
+ { "pcrel.s" "external.s" }
+ { {objdump -Dz pcrel.d} }
+ "pcrel"
+ }
+}
+
+run_ld_link_tests $xstormy16_tests