diff options
author | Nick Clifton <nickc@redhat.com> | 2014-03-26 16:34:04 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2014-03-26 16:34:04 +0000 |
commit | b3fe4307a625457c6953fce27bbbfc4c90e38e9d (patch) | |
tree | 06982b61ced311b4351ab415a3193e89bc015713 /gas | |
parent | 55bfc9ac025c1c9cd1ad5422829b3dc70f357a79 (diff) | |
download | gdb-b3fe4307a625457c6953fce27bbbfc4c90e38e9d.zip gdb-b3fe4307a625457c6953fce27bbbfc4c90e38e9d.tar.gz gdb-b3fe4307a625457c6953fce27bbbfc4c90e38e9d.tar.bz2 |
Add support for %hi8, %hi16 and %lo16 being used when relocation are necessary.
* config/tc-rl78.c (rl78_op): Issue an error message if a 16-bit
relocation is used on an 8-bit operand or vice versa.
(tc_gen_reloc): Use the RL78_16U relocation for RL78_CODE.
(md_apply_fix): Add support for RL78_HI8, RL78_HI16 and RL78_LO16.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-rl78.c | 30 |
2 files changed, 35 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 24a3c15..38362f5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2014-03-26 Nick Clifton <nickc@redhat.com> + + * config/tc-rl78.c (rl78_op): Issue an error message if a 16-bit + relocation is used on an 8-bit operand or vice versa. + (tc_gen_reloc): Use the RL78_16U relocation for RL78_CODE. + (md_apply_fix): Add support for RL78_HI8, RL78_HI16 and RL78_LO16. + 2014-03-25 Nick Clifton <nickc@redhat.com> * config/obj-coff-seh.c (obj_coff_seh_code): New function - diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 962a0b0..ae8f5af 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -208,6 +208,16 @@ rl78_op (expressionS exp, int nbytes, int type) if (nbytes > 2 && exp.X_md == BFD_RELOC_RL78_CODE) exp.X_md = 0; + + if (nbytes == 1 + && (exp.X_md == BFD_RELOC_RL78_LO16 + || exp.X_md == BFD_RELOC_RL78_HI16)) + as_bad (_("16-bit relocation used in 8-bit operand")); + + if (nbytes == 2 + && exp.X_md == BFD_RELOC_RL78_HI8) + as_bad (_("8-bit relocation used in 16-bit operand")); + rl78_op_fixup (exp, rl78_bytes.n_ops * 8, nbytes * 8, type); memset (rl78_bytes.ops + rl78_bytes.n_ops, 0, nbytes); rl78_bytes.n_ops += nbytes; @@ -1197,8 +1207,8 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp) break; case BFD_RELOC_RL78_CODE: - SYM0 (); - OP (ABS16); + reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RL78_16U); + reloc[1] = NULL; break; case BFD_RELOC_RL78_LO16: @@ -1326,6 +1336,22 @@ md_apply_fix (struct fix * f ATTRIBUTE_UNUSED, op[3] = val >> 24; break; + case BFD_RELOC_RL78_HI8: + val = val >> 16; + op[0] = val; + break; + + case BFD_RELOC_RL78_HI16: + val = val >> 16; + op[0] = val; + op[1] = val >> 8; + break; + + case BFD_RELOC_RL78_LO16: + op[0] = val; + op[1] = val >> 8; + break; + default: as_bad (_("Unknown reloc in md_apply_fix: %s"), bfd_get_reloc_code_name (f->fx_r_type)); |