From: Peter Johnson Date: Sat, 10 Jun 2006 17:00:19 +0000 (-0000) Subject: x86_bc_jmp_calc_len(): Make sure we always set jmp->op_sel. X-Git-Tag: v0.6.0~172^2~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6eb02e6c6897dbe96deac131017225173e4a041d;p=yasm x86_bc_jmp_calc_len(): Make sure we always set jmp->op_sel. svn path=/branches/new-optimizer/; revision=1563 --- diff --git a/modules/arch/x86/x86bc.c b/modules/arch/x86/x86bc.c index 51bcbb4e..5ee794c0 100644 --- a/modules/arch/x86/x86bc.c +++ b/modules/arch/x86/x86bc.c @@ -658,6 +658,8 @@ x86_bc_jmp_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, } /* Near jump, no spans needed */ + if (jmp->shortop.len == 0) + jmp->op_sel = JMP_NEAR; bc->len += jmp->nearop.len; bc->len += (opersize == 16) ? 2 : 4; return 0; @@ -678,14 +680,17 @@ x86_bc_jmp_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, && (!yasm_symrec_get_label(jmp->target.rel, &target_prevbc) || target_prevbc->section != bc->section)) { /* External or out of segment, so we can't check distance. - * Allowing forced short jumps depends on the objfmt supporting + * Allowing short jumps depends on the objfmt supporting * 8-bit relocs. While most don't, some might, so allow it here. * Otherwise default to word-sized. * The objfmt will error if not supported. */ if (jmp->op_sel == JMP_SHORT_FORCED || jmp->nearop.len == 0) { + if (jmp->nearop.len == 0) + jmp->op_sel = JMP_SHORT; bc->len += jmp->shortop.len + 1; } else { + jmp->op_sel = JMP_NEAR; bc->len += jmp->nearop.len; bc->len += (opersize == 16) ? 2 : 4; }