From 412167cbaa214b161aec426ee4fe424e31fc766e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 9 May 2002 06:35:22 +0000 Subject: [PATCH] * config/tc-i386.c (md_estimate_size_before_relax) Don't lose reloc when no_cond_jump_promotion. --- gas/ChangeLog | 5 +++++ gas/config/tc-i386.c | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index b8c14237f91..097e548b58e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2002-05-09 Alan Modra + + * config/tc-i386.c (md_estimate_size_before_relax) Don't lose + reloc when no_cond_jump_promotion. + 2002-05-08 Jim Wilson * config/tc-i960.c (md_estimate_size_before_relax): Return size of diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index bb1d512c77b..f681014e278 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4235,10 +4235,8 @@ md_estimate_size_before_relax (fragP, segment) break; case COND_JUMP86: - if (no_cond_jump_promotion) - goto relax_guess; - - if (size == 2) + if (size == 2 + && (!no_cond_jump_promotion || fragP->fr_var != NO_RELOC)) { /* Negate the condition, and branch past an unconditional jump. */ @@ -4258,8 +4256,15 @@ md_estimate_size_before_relax (fragP, segment) /* Fall through. */ case COND_JUMP: - if (no_cond_jump_promotion) - goto relax_guess; + if (no_cond_jump_promotion && fragP->fr_var == NO_RELOC) + { + fragP->fr_fix += 1; + fix_new (fragP, old_fr_fix, 1, + fragP->fr_symbol, + fragP->fr_offset, 1, + BFD_RELOC_8_PCREL); + break; + } /* This changes the byte-displacement jump 0x7N to the (d)word-displacement jump 0x0f,0x8N. */ @@ -4281,7 +4286,6 @@ md_estimate_size_before_relax (fragP, segment) return fragP->fr_fix - old_fr_fix; } - relax_guess: /* Guess size depending on current relax state. Initially the relax state will correspond to a short jump and we return 1, because the variable part of the frag (the branch offset) is one byte -- 2.30.2