Bad generation of jmp r/m32 with offset

Alan Modra alan@SPRI.Levels.UniSA.Edu.Au
Mon Jan 17 14:58:00 GMT 2000


>[snip]
> GNU as version 2.9.5 (BFD 2.9.5.0.22) issues no warning but instead
> assembles the jump incorectly as:
> 	FF6804	(JMP FAR mem)
> 
> Although it is the behavior of the assembler that has changed I
> believe this is a bug in gcc as it is emiting the wrong assembly.  If
> the jump instruction is changed from
> 		jmp 4(%eax)
> to
> 		jmp *4(%eax)
> 
> Then no warning is issued from as 2.9.1 and both assemblers generate
> the correct binary code.

This isn't a gcc bug, as I believe gcc has no way of knowing that a "*" is
needed for correct asm syntax.  You should provide the "*" in your asm
statement.

However, it *is* a bug in the 2.9.5.0.22 assembler, introduced when
.intel_mode syntax support was added.  It was fixed 1999-12-27,
and I see H.J. Lu has made a 2.9.5.0.24 release of the linux binutils at
ftp.varesearch.com/pub/support/hjl/binutils/

The new assembler will accept "jmp 4(%eax)" with a warning, and generate
the correct code.  Please test it out, and send assembler bug reports to
binutils@sourceware.cygnus.com



More information about the Gcc-bugs mailing list