aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-04-01 08:22:47 +0000
committerNick Clifton <nickc@redhat.com>2004-04-01 08:22:47 +0000
commita7844384e8a2fc5db1a82c63ba6460e87f735a28 (patch)
tree673c2dfa6ba6d2b2815531158027615d4053e2b9
parentfe046a1715e355f086a3f7a5b8efbfe11c9ba902 (diff)
downloadgdb-a7844384e8a2fc5db1a82c63ba6460e87f735a28.zip
gdb-a7844384e8a2fc5db1a82c63ba6460e87f735a28.tar.gz
gdb-a7844384e8a2fc5db1a82c63ba6460e87f735a28.tar.bz2
Correctly emit lo16 relocs for elf-dlx target, fixing bogus range checking bug.
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-dlx.c19
-rw-r--r--gas/testsuite/ChangeLog11
-rw-r--r--gas/testsuite/gas/dlx/alltests.exp1
-rw-r--r--gas/testsuite/gas/dlx/itype.d2
-rw-r--r--gas/testsuite/gas/dlx/lhi.d6
-rw-r--r--gas/testsuite/gas/dlx/lohi.d18
-rw-r--r--gas/testsuite/gas/dlx/lohi.s9
8 files changed, 70 insertions, 6 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 444d9d6..01cc9b0 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2004-04-01 Dave Korn <dk@artimi.com>
+
+ * config/tc-dlx.c (md_assemble): set fx_no_overflow flag for
+ hi16 and lo16 fixS structs.
+ (md_assemble): generate bit_fixS for RELOC_DLX_LO16 in
+ exactly the same way as for RELOC_DLX_REL16.
+ (machine_ip): properly respect LO flag in the_insn and
+ output RELOC_DLX_LO16 rather than RELOC_DLX_16.
+ (md_apply_fix3): apply RELOC_DLX_LO16.
+
2004-03-30 Stan Shebs <shebs@apple.com>
Remove long-obsolete MPW support.
diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c
index 4b72b56..82b4aa2 100644
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -1,5 +1,5 @@
/* tc-ldx.c -- Assemble for the DLX
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -397,6 +397,18 @@ md_assemble (str)
the_insn.size, & the_insn.exp, the_insn.pcrel,
the_insn.reloc);
+ /* Turn off complaints that the addend is
+ too large for things like foo+100000@ha. */
+ switch (the_insn.reloc)
+ {
+ case RELOC_DLX_HI16:
+ case RELOC_DLX_LO16:
+ fixP->fx_no_overflow = 1;
+ break;
+ default:
+ break;
+ }
+
switch (fixP->fx_r_type)
{
case RELOC_DLX_REL26:
@@ -410,6 +422,7 @@ md_assemble (str)
bitP->fx_bit_add = 0x03FFFFFF;
fixP->fx_bit_fixP = bitP;
break;
+ case RELOC_DLX_LO16:
case RELOC_DLX_REL16:
bitP = malloc (sizeof (bit_fixS));
bitP->fx_bit_size = 16;
@@ -955,7 +968,8 @@ machine_ip (str)
continue;
}
- the_insn.reloc = (the_insn.HI) ? RELOC_DLX_HI16 : RELOC_DLX_16;
+ the_insn.reloc = (the_insn.HI) ? RELOC_DLX_HI16
+ : (the_insn.LO ? RELOC_DLX_LO16 : RELOC_DLX_16);
the_insn.reloc_offset = 2;
the_insn.size = 2;
the_insn.pcrel = 0;
@@ -1164,6 +1178,7 @@ md_apply_fix3 (fixP, valP, seg)
switch (fixP->fx_r_type)
{
+ case RELOC_DLX_LO16:
case RELOC_DLX_REL16:
if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
{
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index c11a82c..907a2e8 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2004-04-01 Dave Korn <dk@artimi.com>
+
+ * gas/dlx/alltests.exp: Execute new lohi test.
+ * gas/dlx/lohi.s: New test for spurious lo16/hi16
+ reloc overflow checking.
+ * gas/dlx/lohi.d: New file: expected output.
+ * gas/dlx/lhi.d: Updated to properly expect lo16
+ relocations where asked for.
+ * gas/dlx/itype.d: Likewise.
+ * gas/dlx/lhi.d: Corrected cut+paste error in test name.
+
2004-03-30 Stan Shebs <shebs@apple.com>
* gas/macros/macros.exp: Remove mention of MPW config.
diff --git a/gas/testsuite/gas/dlx/alltests.exp b/gas/testsuite/gas/dlx/alltests.exp
index 003448b..cee7f35 100644
--- a/gas/testsuite/gas/dlx/alltests.exp
+++ b/gas/testsuite/gas/dlx/alltests.exp
@@ -5,6 +5,7 @@ if [istarget dlx*-*-*] {
run_dump_test "itype"
run_dump_test "lhi"
run_dump_test "load"
+ run_dump_test "lohi"
run_dump_test "rtype"
run_dump_test "store"
}
diff --git a/gas/testsuite/gas/dlx/itype.d b/gas/testsuite/gas/dlx/itype.d
index 845ae41..1b8e92b 100644
--- a/gas/testsuite/gas/dlx/itype.d
+++ b/gas/testsuite/gas/dlx/itype.d
@@ -16,7 +16,7 @@ Disassembly of section .text:
12: R_DLX_RELOC_16 .text
14: 35 4c 00 78 ori r12,r10,0x0078
18: 39 af 00 00 xori r15,r13,0x0000
- 1a: R_DLX_RELOC_16 .text
+ 1a: R_DLX_RELOC_16_LO .text
1c: da 30 00 1c slli r16,r17,0x001c
1e: R_DLX_RELOC_16 .text
20: e2 93 00 0f srai r19,r20,0x000f
diff --git a/gas/testsuite/gas/dlx/lhi.d b/gas/testsuite/gas/dlx/lhi.d
index db3b35d..e855129 100644
--- a/gas/testsuite/gas/dlx/lhi.d
+++ b/gas/testsuite/gas/dlx/lhi.d
@@ -1,6 +1,6 @@
#as:
#objdump: -dr
-#name: itype
+#name: lhi
.*: +file format .*
@@ -11,7 +11,7 @@ Disassembly of section .text:
4: 3c 03 00 00 lhi r3,0x0000
6: R_DLX_RELOC_16_HI .text
8: 3c 04 00 00 lhi r4,0x0000
- a: R_DLX_RELOC_16 .text
+ a: R_DLX_RELOC_16_LO .text
c: 3c 04 ff fb lhi r4,0xfffb
e: R_DLX_RELOC_16 .text
10: 3c 04 00 0c lhi r4,0x000c
@@ -19,5 +19,5 @@ Disassembly of section .text:
18: 20 04 00 00 addi r4,r0,0x0000
1a: R_DLX_RELOC_16_HI .text
1c: 34 84 00 18 ori r4,r4,0x0018
- 1e: R_DLX_RELOC_16 .text
+ 1e: R_DLX_RELOC_16_LO .text
20: 20 64 00 00 addi r4,r3,0x0000
diff --git a/gas/testsuite/gas/dlx/lohi.d b/gas/testsuite/gas/dlx/lohi.d
new file mode 100644
index 0000000..f97ef35
--- /dev/null
+++ b/gas/testsuite/gas/dlx/lohi.d
@@ -0,0 +1,18 @@
+#as:
+#objdump: -dr
+#name: lohi
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+00000000 <.text>:
+ 0: 00 00 00 00 nop
+ 4: 3c 01 00 03 lhi r1,0x0003
+ 6: R_DLX_RELOC_16_HI .text
+ 8: 34 01 0d 44 ori r1,r0,0x0d44
+ a: R_DLX_RELOC_16_LO .text
+ c: 3c 01 0b eb lhi r1,0x0beb
+ e: R_DLX_RELOC_16_HI .text
+ 10: 34 01 c2 04 ori r1,r0,0xc204
+ 12: R_DLX_RELOC_16_LO .text
diff --git a/gas/testsuite/gas/dlx/lohi.s b/gas/testsuite/gas/dlx/lohi.s
new file mode 100644
index 0000000..f88ad44
--- /dev/null
+++ b/gas/testsuite/gas/dlx/lohi.s
@@ -0,0 +1,9 @@
+ .text
+ .align 2
+ nop
+.L1:
+ lhi r1,%hi(.L1 + 200000)
+ ori r1,r0,%lo(.L1 + 200000)
+ lhi r1,%hi(.L1 + 200000000)
+ ori r1,r0,%lo(.L1 + 200000000)
+ .end