From: Andreas Schwab Date: Wed, 27 Mar 2002 16:20:41 +0000 (+0000) Subject: * config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of X-Git-Tag: binutils-2_12_1~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a2a748cf0963bb7c5c32a15a6efd2bd0d3a41cc5;p=thirdparty%2Fbinutils-gdb.git * config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of field for pc-relative fixups. (md_estimate_size_before_relax): Likewise. (tc_gen_reloc): Subtract fx_pcrel_adjust instead of fx_size for pc-relative fixups in 64bit mode. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index cd0abbb6331..9a720f56ecb 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2002-03-27 Andreas Schwab + + * config/tc-i386.c (md_assemble): Set fx_pcrel_adjust to size of + field for pc-relative fixups. + (md_estimate_size_before_relax): Likewise. + (tc_gen_reloc): Subtract fx_pcrel_adjust instead of fx_size for + pc-relative fixups in 64bit mode. + 2002-03-20 Albert Chin-A-Young * config/tc-arm.c (vfp_dp_reg_required_here): Fix typo diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2b82037a8ba..ede47f97c9f 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2817,6 +2817,7 @@ md_assemble (line) else if (i.tm.opcode_modifier & (JumpByte | JumpDword)) { int size; + fixS *fixP; if (i.tm.opcode_modifier & JumpByte) { @@ -2867,8 +2868,9 @@ md_assemble (line) p = frag_more (1 + size); *p++ = i.tm.base_opcode; - fix_new_exp (frag_now, p - frag_now->fr_literal, size, - i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0])); + fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0])); + fixP->fx_pcrel_adjust = size; } else if (i.tm.opcode_modifier & JumpInterSegment) { @@ -3024,6 +3026,7 @@ md_assemble (line) int size = 4; int sign = 0; int pcrel = (i.flags[n] & Operand_PCrel) != 0; + fixS *fixP; /* The PC relative address is computed relative to the instruction boundary, so in case immediate @@ -3063,9 +3066,11 @@ md_assemble (line) } p = frag_more (size); - fix_new_exp (frag_now, p - frag_now->fr_literal, size, - i.op[n].disps, pcrel, - reloc (size, pcrel, sign, i.reloc[n])); + fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, + size, i.op[n].disps, pcrel, + reloc (size, pcrel, sign, i.reloc[n])); + if (pcrel) + fixP->fx_pcrel_adjust = size; } } } @@ -4019,6 +4024,7 @@ md_estimate_size_before_relax (fragP, segment) RELOC_ENUM reloc_type; unsigned char *opcode; int old_fr_fix; + fixS *fixP; if (fragP->fr_var != NO_RELOC) reloc_type = fragP->fr_var; @@ -4036,10 +4042,11 @@ md_estimate_size_before_relax (fragP, segment) /* Make jmp (0xeb) a (d)word displacement jump. */ opcode[0] = 0xe9; fragP->fr_fix += size; - fix_new (fragP, old_fr_fix, size, - fragP->fr_symbol, - fragP->fr_offset, 1, - reloc_type); + fixP = fix_new (fragP, old_fr_fix, size, + fragP->fr_symbol, + fragP->fr_offset, 1, + reloc_type); + fixP->fx_pcrel_adjust = size; break; case COND_JUMP86: @@ -4057,10 +4064,11 @@ md_estimate_size_before_relax (fragP, segment) /* We added two extra opcode bytes, and have a two byte offset. */ fragP->fr_fix += 2 + 2; - fix_new (fragP, old_fr_fix + 2, 2, - fragP->fr_symbol, - fragP->fr_offset, 1, - reloc_type); + fixP = fix_new (fragP, old_fr_fix + 2, 2, + fragP->fr_symbol, + fragP->fr_offset, 1, + reloc_type); + fixP->fx_pcrel_adjust = size; break; } /* Fall through. */ @@ -4075,10 +4083,11 @@ md_estimate_size_before_relax (fragP, segment) opcode[0] = TWO_BYTE_OPCODE_ESCAPE; /* We've added an opcode byte. */ fragP->fr_fix += 1 + size; - fix_new (fragP, old_fr_fix + 1, size, - fragP->fr_symbol, - fragP->fr_offset, 1, - reloc_type); + fixP = fix_new (fragP, old_fr_fix + 1, size, + fragP->fr_symbol, + fragP->fr_offset, 1, + reloc_type); + fixP->fx_pcrel_adjust = size; break; default: @@ -4920,7 +4929,7 @@ tc_gen_reloc (section, fixp) { rel->addend = fixp->fx_offset; if (fixp->fx_pcrel) - rel->addend -= fixp->fx_size; + rel->addend -= fixp->fx_pcrel_adjust; } rel->howto = bfd_reloc_type_lookup (stdoutput, code);