From c51ce5f0646879e7a1070673df888435204dcb1a Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 1 Nov 2000 00:54:00 +0000 Subject: [PATCH] 2000-10-31 Eric Christopher * config/tc-mn10300.c (md_apply_fix3): Use valuep if fully resolved or pc-relative, else use fx_offset. --- gas/ChangeLog | 15 ++++++++++----- gas/config/tc-mn10300.c | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9be145345ce..881bd1f35fe 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2000-10-31 Eric Christopher + + * config/tc-mn10300.c (md_apply_fix3): Use valuep if fully resolved + or pc-relative, else use fx_offset. + 2000-10-31 Jim Wilson * config/tc-ia64.c (struct md): New field tag_fixups. @@ -10,7 +15,7 @@ (ia64_unrecognized_line, case '['): Parse tags. (ia64_frob_label): Create tag_fixups. (md_assemble): Reset md.qp.X_op after using it. - + 2000-10-31 Kaz Kojima * config/tc-sh.c (md_apply_fix [BFD_RELOC_SH_PCDISP12BY2]): Allow 4094. @@ -41,7 +46,7 @@ * configure.in (emulations): Add m68hc12. * configure: Regenerate. * po/gas.pot: Regenerate. - + 2000-10-27 Aldy Hernandez * config/tc-arm.c (psrs): Remove lowercase versions of spsr* and @@ -61,10 +66,10 @@ * doc/as.texinfo: Note that --gdwarf2 only works on some targets, not all. - + * config/tc-arm.h (md_end): Define. (DWARF2_LINE_MIN_INSN_LENGTH): Define. - + * config/tc-arm.c (output_inst): Call dwarf2_generate_asm_lineno if generating DWARF2 line numbers. (arm_end_of_source): New function. Call dwarf2_finish if @@ -73,7 +78,7 @@ * config/tc-hppa.c (md_assemble): Use dwarf2_generate_asm_lineno. * config/tc-m68hc11.c (m68hc11_new_insn): Use dwarf2_generate_asm_lineno. * config/tc-sh.c (md_assemble): Use dwarf2_generate_asm_lineno. - + 2000-10-25 Diego Novillo * tc-i386.c: Fix prototype declarations for functions taking no diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 301a42bac49..5137bf41b81 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -1912,11 +1912,12 @@ md_pcrel_from (fixp) int md_apply_fix3 (fixp, valuep, seg) fixS *fixp; - valueT *valuep ATTRIBUTE_UNUSED; + valueT *valuep; segT seg; { char *fixpos = fixp->fx_where + fixp->fx_frag->fr_literal; int size = 0; + int value; assert (fixp->fx_r_type < BFD_RELOC_UNUSED); @@ -1924,6 +1925,23 @@ md_apply_fix3 (fixp, valuep, seg) if (seg->flags & SEC_ALLOC) abort (); + /* The value we are passed in *valuep includes the symbol values. + Since we are using BFD_ASSEMBLER, if we are doing this relocation + the code in write.c is going to call bfd_install_relocation, which + is also going to use the symbol value. That means that if the + reloc is fully resolved we want to use *valuep since + bfd_install_relocation is not being used. + + However, if the reloc is not fully resolved we do not want to use + *valuep, and must use fx_offset instead. However, if the reloc + is PC relative, we do want to use *valuep since it includes the + result of md_pcrel_from. */ + if (fixp->fx_addsy == (symbolS *) NULL || fixp->fx_pcrel) + value = *valuep; + else + value = fixp->fx_offset; + + /* If the fix is relative to a symbol which is not defined, or not in the same segment as the fix, we cannot resolve it here. */ if (fixp->fx_addsy != NULL @@ -1959,7 +1977,7 @@ md_apply_fix3 (fixp, valuep, seg) _("Bad relocation fixup type (%d)"), fixp->fx_r_type); } - md_number_to_chars (fixpos, fixp->fx_offset, size); + md_number_to_chars (fixpos, value, size); fixp->fx_done = 1; return 0; -- 2.30.2