string = s;
if (strcmp (string, "nojumps") == 0)
- no_cond_jump_promotion = 1;
+ {
+ if (cpu_arch_flags.bitfield.cpui386)
+ as_bad (_("`%s' only supported with 16-bit architectures"), string);
+ else
+ no_cond_jump_promotion = true;
+ }
else if (strcmp (string, "jumps") != 0)
{
as_bad (_("no such architecture modifier: `%s'"), string);
fragP->tc_frag_data.last_insn_normal
= (seg_info(now_seg)->tc_segment_info_data.last_insn.kind
== last_insn_other);
+ fragP->tc_frag_data.no_cond_jump_promotion = no_cond_jump_promotion;
}
/* Calculate the maximum variable size (i.e., excluding fr_fix)
break;
case COND_JUMP86:
- if (size == 2
- && (!no_cond_jump_promotion || fragP->fr_var != NO_RELOC))
+ if (fragP->tc_frag_data.no_cond_jump_promotion
+ && fragP->fr_var == NO_RELOC)
+ {
+ fragP->fr_fix += 1;
+ fixP = fix_new (fragP, old_fr_fix, 1,
+ fragP->fr_symbol,
+ fragP->fr_offset, 1,
+ BFD_RELOC_8_PCREL);
+ fixP->fx_signed = 1;
+ break;
+ }
+
+ if (size == 2)
{
/* Negate the condition, and branch past an
unconditional jump. */
/* Fall through. */
case COND_JUMP:
- if (no_cond_jump_promotion && fragP->fr_var == NO_RELOC)
- {
- fragP->fr_fix += 1;
- fixP = fix_new (fragP, old_fr_fix, 1,
- fragP->fr_symbol,
- fragP->fr_offset, 1,
- BFD_RELOC_8_PCREL);
- fixP->fx_signed = 1;
- break;
- }
-
/* This changes the byte-displacement jump 0x7N
to the (d)word-displacement jump 0x0f,0x8N. */
opcode[1] = opcode[0] + 0x10;
}
else
{
- if (no_cond_jump_promotion
+ if (fragP->tc_frag_data.no_cond_jump_promotion
&& TYPE_FROM_RELAX_STATE (fragP->fr_subtype) != UNCOND_JUMP)
as_warn_where (fragP->fr_file, fragP->fr_line,
_("long jump required"));
unsigned int cpunop : 1;
unsigned int isanop : 1;
unsigned int last_insn_normal : 1;
+ bool no_cond_jump_promotion : 1;
};
/* We need to emit the right NOP pattern in .align frags. This is
insists upon masking @samp{%eip} to 16 bits after the word displacement
is added. (See also @pxref{i386-Arch})
-Note that the @samp{jcxz}, @samp{jecxz}, @samp{loop}, @samp{loopz},
-@samp{loope}, @samp{loopnz} and @samp{loopne} instructions only come in byte
-displacements, so that if you use these instructions (@code{@value{GCC}} does
-not use them) you may get an error message (and incorrect code). The AT&T
+Note that the @samp{jcxz}, @samp{jecxz}, @samp{jrcxz}, @samp{loop},
+@samp{loopz}, @samp{loope}, @samp{loopnz} and @samp{loopne} instructions only
+come with byte displacements, so that if you use these instructions
+(@code{@value{GCC}} does not use them) you may get an error message. The AT&T
80386 assembler tries to get around this problem by expanding @samp{jcxz foo}
to
On SVR4-derived platforms, the separator character @samp{/} can be replaced by
@samp{:}.
-Following the CPU architecture (but not a sub-architecture, which are those
-starting with a dot), you may specify @samp{jumps} or @samp{nojumps} to
+Following a 16-bit CPU architecture (but not a sub-architecture, which are
+those starting with a dot), you may specify @samp{jumps} or @samp{nojumps} to
control automatic promotion of conditional jumps. @samp{jumps} is the
default, and enables jump promotion; All external jumps will be of the long
variety, and file-local jumps will be promoted as necessary.
run_dump_test "dw2-compressed-3b"
if {![istarget "i*86-*-elfiamcu"]} then {
+ run_dump_test nojumps
run_dump_test "property-2"
run_dump_test "property-3"
run_dump_test "property-4"
--- /dev/null
+#name: ix86 nojumps
+#objdump: -drw -Mi8086
+#warning_output: nojumps.e
+
+.*: +file format .*86.*
+
+Disassembly of section \.text:
+
+0+ <early>:
+[ ]*[a-f0-9]+: 73 03 jae 5 <early\+0x5>
+[ ]*[a-f0-9]+: e9 81 00 jmp 86 <late>
+[ ]*[a-f0-9]+: 70 (00|ff) jo [76] <.*> 6: R_(386|X86_64)_PC8 undef.*
+[ ]*[a-f0-9]+: 7a (00|ff) jp [98] <.*> 8: R_(386|X86_64)_PC8 .*
+[ ]*[a-f0-9]+: eb 7b jmp 86 <late>
+#...
+0+86 <late>:
+[ ]*[a-f0-9]+: 75 03 jne 8b <late\+0x5>
+[ ]*[a-f0-9]+: e9 75 ff jmp 0 <early>
+[ ]*[a-f0-9]+: 74 03 je 90 <late\+0xa>
+[ ]*[a-f0-9]+: e9 (00|fe) (00|ff) jmp (90|8e) <.*> 8e: R_(386|X86_64)_PC16 .*
+[ ]*[a-f0-9]+: 75 03 jne 95 <late\+0xf>
+[ ]*[a-f0-9]+: e9 (00|fe) (00|ff) jmp 9[53] <.*> 93: R_(386|X86_64)_PC16 undef.*
+[ ]*[a-f0-9]+: 79 03 jns 9a <late\+0x14>
+[ ]*[a-f0-9]+: e9 66 ff jmp 0 <early>
+[ ]*[a-f0-9]+: c3 ret
+#...
+Disassembly of section \.text\.other:
+
+0+ <other>:
+[ ]*[a-f0-9]+: 78 (00|ff) js [21] <.*> 1: R_(386|X86_64)_PC8 .*
+#pass
--- /dev/null
+.*: Assembler messages:
+.*:11: Warning: long jump required
+.*:16: Warning: long jump required
--- /dev/null
+ .code16
+ .arch i8086,nojumps
+
+ .section .text.other, "ax", @progbits
+other:
+ js early
+ ret
+
+ .text
+early:
+ jc late
+ jo undef
+ jp other
+ .nops 125
+late:
+ jz early
+ .arch i8086,jumps
+ jnz other
+ jz undef
+ js early
+ ret