From 599ef811c38c8ef3fc46bce3b738d455b618eb28 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sat, 13 Dec 1997 00:58:43 +0000 Subject: [PATCH] * config/tc-tic80.c (build_insn): Handle instructions that have long (32 bit) PC relative offsets. Fix places that previously misused R_MPPCR for 15 bit offsets to use the new R_MPPCR15W type. (md_apply_fix): Add case to handle long PC relative offsets. PR 12927 --- gas/ChangeLog | 9 ++++++++ gas/config/tc-tic80.c | 51 +++++++++++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 23a6bde0164..bb094b88c38 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +start-sanitize-tic80 +Fri Dec 12 11:44:20 1997 Fred Fish + + * config/tc-tic80.c (build_insn): Handle instructions that have + long (32 bit) PC relative offsets. Fix places that previously + misused R_MPPCR for 15 bit offsets to use the new R_MPPCR15W type. + (md_apply_fix): Add case to handle long PC relative offsets. + +end-sanitize-tic80 Fri Dec 12 10:35:01 1997 Nick Clifton * doc/c-arm.texi (ARM Options): Document support for new ARM diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c index 9c33eaa34ec..b77681d48d6 100644 --- a/gas/config/tc-tic80.c +++ b/gas/config/tc-tic80.c @@ -635,26 +635,38 @@ build_insn (opcode, opers) } break; case O_symbol: - if (flags & TIC80_OPERAND_PCREL) + if (bits == 32) + { + fx = frag_more (4); + fxfrag = frag_now; + insn[1] = 0; + if (flags & TIC80_OPERAND_PCREL) + { + fix_new_exp (fxfrag, + fx - (fxfrag -> fr_literal), + 4, + &opers[expi], + 1, + R_MPPCR); + } + else + { + fix_new_exp (fxfrag, + fx - (fxfrag -> fr_literal), + 4, + &opers[expi], + 0, + R_RELLONGX); + } + } + else if (flags & TIC80_OPERAND_PCREL) { fix_new_exp (ffrag, f - (ffrag -> fr_literal), 4, /* FIXME! how is this used? */ &opers[expi], 1, - R_MPPCR); - } - else if (bits == 32) /* was (flags & TIC80_OPERAND_BASEREL) */ - { - fx = frag_more (4); - fxfrag = frag_now; - insn[1] = 0; - fix_new_exp (fxfrag, - fx - (fxfrag -> fr_literal), - 4, - &opers[expi], - 0, - R_RELLONGX); + R_MPPCR15W); } else { @@ -931,10 +943,17 @@ md_apply_fix (fixP, val) md_number_to_chars (dest, (valueT) val, 4); break; case R_MPPCR: - overflow = (val < -65536) || (val > 65532); + val >>= 2; + val += 1; /* Target address computed from inst start */ + md_number_to_chars (dest, (valueT) val, 4); + break; + case R_MPPCR15W: + overflow = (val < -65536L) || (val > 65532L); if (overflow) { - as_bad_where (fixP -> fx_file, fixP -> fx_line, "PC relative target out of range"); + as_bad_where (fixP -> fx_file, fixP -> fx_line, + "PC offset 0x%lx outside range 0x%lx-0x%lx", + val, -65536L, 65532L); } else { -- 2.30.2