summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2004-12-16 16:56:04 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2004-12-16 16:56:04 +0000
commit1e50d24d553250622687bbc21027e8bfdb31870f (patch)
treec66a5fff096c41f49cd675874937fafe98209022 /gas
parent2fbd2a87e2cd23eba4eae6341661ce0149be08b1 (diff)
downloadbinutils-gdb-1e50d24d553250622687bbc21027e8bfdb31870f.tar.gz
include/elf/
* v850.h (R_V850_LO16_SPLIT_OFFSET): New reloc. bfd/ * reloc.c (BFD_RELOC_V850_LO16_SPLIT_OFFSET): New bfd_reloc_code_type. * elf32-v850.c (v850_elf_howto_table): Add entry for R_V850_LO16_SPLIT_OFFSET. (v850_elf_reloc_map): Map it to BFD_RELOC_V850_LO16_SPLIT_OFFSET. (v850_elf_perform_lo16_relocation): New function, extracted from... (v850_elf_perform_relocation): ...here. Use it to handle R_V850_LO16_SPLIT_OFFSET. (v850_elf_check_relocs, v850_elf_final_link_relocate): Handle R_V850_LO16_SPLIT_OFFSET. * libbfd.h, bfd-in2.h: Regenerate. gas/ * config/tc-v850.c (handle_lo16): New function. (v850_reloc_prefix): Use it to check lo(). (md_assemble, md_apply_fix3): Handle BFD_RELOC_V850_LO16_SPLIT_OFFSET. gas/testsuite/ * gas/v850/split-lo16.{s,d}: New test. * gas/v850/v850.exp: Run it. ld/testsuite/ * ld-v850: New directory.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-v850.c29
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/v850/basic.exp1
-rw-r--r--gas/testsuite/gas/v850/split-lo16.d16
-rw-r--r--gas/testsuite/gas/v850/split-lo16.s7
6 files changed, 62 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e7f185928a7..392a8ec9be0 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-16 Richard Sandiford <rsandifo@redhat.com>
+
+ * config/tc-v850.c (handle_lo16): New function.
+ (v850_reloc_prefix): Use it to check lo().
+ (md_assemble, md_apply_fix3): Handle BFD_RELOC_V850_LO16_SPLIT_OFFSET.
+
2004-12-14 P.J. Darcy <darcypj@us.ibm.com>
* configure.in: Add s390x-ibm-tpf support.
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index ed208ee2d2b..dfa1c7f3cfd 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1375,6 +1375,25 @@ md_begin ()
bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
}
+static bfd_reloc_code_real_type
+handle_lo16 (const struct v850_operand *operand)
+{
+ if (operand != NULL)
+ {
+ if (operand->bits == -1)
+ return BFD_RELOC_V850_LO16_SPLIT_OFFSET;
+
+ if (!(operand->bits == 16 && operand->shift == 16)
+ && !(operand->bits == 15 && operand->shift == 17))
+ {
+ as_bad (_("lo() relocation used on an instruction which does "
+ "not support it"));
+ return BFD_RELOC_64; /* Used to indicate an error condition. */
+ }
+ }
+ return BFD_RELOC_LO16;
+}
+
static bfd_reloc_code_real_type handle_ctoff
PARAMS ((const struct v850_operand *));
@@ -1516,7 +1535,7 @@ v850_reloc_prefix (operand)
CHECK_ ("hi0", BFD_RELOC_HI16 );
CHECK_ ("hi", BFD_RELOC_HI16_S );
- CHECK_ ("lo", BFD_RELOC_LO16 );
+ CHECK_ ("lo", handle_lo16 (operand) );
CHECK_ ("sdaoff", handle_sdaoff (operand));
CHECK_ ("zdaoff", handle_zdaoff (operand));
CHECK_ ("tdaoff", handle_tdaoff (operand));
@@ -1755,6 +1774,7 @@ md_assemble (str)
/* Fall through. */
case BFD_RELOC_LO16:
+ case BFD_RELOC_V850_LO16_SPLIT_OFFSET:
{
/* Truncate, then sign extend the value. */
ex.X_add_number = SEXT16 (ex.X_add_number);
@@ -2199,6 +2219,7 @@ md_assemble (str)
switch (reloc)
{
case BFD_RELOC_LO16:
+ case BFD_RELOC_V850_LO16_SPLIT_OFFSET:
case BFD_RELOC_HI16:
case BFD_RELOC_HI16_S:
fixP->fx_no_overflow = 1;
@@ -2405,7 +2426,11 @@ md_apply_fix3 (fixP, valueP, seg)
/* We still have to insert the value into memory! */
where = fixP->fx_frag->fr_literal + fixP->fx_where;
- if (fixP->fx_size == 1)
+ if (fixP->fx_r_type == BFD_RELOC_V850_LO16_SPLIT_OFFSET)
+ bfd_putl32 (((value << 16) & 0xfffe0000)
+ | ((value << 5) & 0x20)
+ | (bfd_getl32 (where) & ~0xfffe0020), where);
+ else if (fixP->fx_size == 1)
*where = value & 0xff;
else if (fixP->fx_size == 2)
bfd_putl16 (value & 0xffff, (unsigned char *) where);
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 56c056ec827..3b19181a7a0 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-16 Richard Sandiford <rsandifo@redhat.com>
+
+ * gas/v850/split-lo16.{s,d}: New test.
+ * gas/v850/v850.exp: Run it.
+
2004-12-15 Jan Beulich <jbeulich@novell.com>
* gas/elf/section5.[els]: New.
diff --git a/gas/testsuite/gas/v850/basic.exp b/gas/testsuite/gas/v850/basic.exp
index e3b0713bae8..1cf251ee811 100644
--- a/gas/testsuite/gas/v850/basic.exp
+++ b/gas/testsuite/gas/v850/basic.exp
@@ -436,4 +436,5 @@ if [istarget v850*-*-*] then {
gas_test_error "range.s" "-mwarn-signed-overflow" "Check for range error on byte load/store"
run_dump_test "v850e1"
+ run_dump_test "split-lo16"
}
diff --git a/gas/testsuite/gas/v850/split-lo16.d b/gas/testsuite/gas/v850/split-lo16.d
new file mode 100644
index 00000000000..9503ac9d8d0
--- /dev/null
+++ b/gas/testsuite/gas/v850/split-lo16.d
@@ -0,0 +1,16 @@
+#objdump: -dr
+#name: V850E split LO16 tests
+#as: -mv850e
+#...
+00000000 <.*>:
+ 0: 40 0e 00 00 movhi 0, r0, r1
+ 2: R_V850_HI16_S foo
+ 4: 01 16 00 00 addi 0, r1, r2
+ 6: R_V850_LO16 foo
+ 8: 01 17 00 00 ld\.b 0\[r1\],r2
+ a: R_V850_LO16 foo
+ c: 81 17 01 00 ld\.bu 0\[r1\],r2
+ c: R_V850_LO16_SPLIT_OFFSET foo
+ 10: a1 17 45 23 ld\.bu 9029\[r1\],r2
+ 14: 81 17 57 34 ld\.bu 13398\[r1\],r2
+#pass
diff --git a/gas/testsuite/gas/v850/split-lo16.s b/gas/testsuite/gas/v850/split-lo16.s
new file mode 100644
index 00000000000..fc3afd14e6e
--- /dev/null
+++ b/gas/testsuite/gas/v850/split-lo16.s
@@ -0,0 +1,7 @@
+ movhi hi(foo),r0,r1
+ addi lo(foo),r1,r2
+ ld.b lo(foo),r1,r2
+ ld.bu lo(foo),r1,r2
+
+ ld.bu lo(0x12345),r1,r2
+ ld.bu lo(0x123456),r1,r2