Created attachment 5679 [details] A test for backward local labels with Intel syntax File test.asm: .intel_syntax mov eax, 5 1: dec eax jnz 1b ret Command line (under MinGW): as test.asm -o test.o ld test.o -o test.exe Actual result: jump two bytes forward. 00401000 B8 05000000 mov eax,5 00401005 48 dec eax 00401006 +--- 75 02 jne short test.0040100A ; error 00401008 | C3 ret 00401009 | 90 nop 0040100A +-> 90 nop Expected result: jump three bytes back: 00401000 B8 05000000 mov eax,5 00401005 +-> 48 dec eax 00401006 +--- 75 FD jne short test.00401005 00401008 C3 ret Additional information If you specify -a switch (as test.asm -o test.o -a), the bug disappears. If you rewrite the assembly code using AT&T syntax, it also disappears: mov $5, %eax 1: dec %eax jnz 1b ret I checked the object file (test.o) generated by the GNU Assembler and found the erroneous jump address in it (so it's not a linker bug).
Today's CVS works for me: [hjl@gnu-6 pr12687]$ cat x.s .intel_syntax mov eax, 5 1: dec eax jnz 1b ret [hjl@gnu-6 pr12687]$ make ./as --32 -o x.o x.s ./ld -o x x.o ./objdump -dw -Mintel x x: file format pei-i386 Disassembly of section .text: 00401000 <.text>: 401000: b8 05 00 00 00 mov eax,0x5 401005: 48 dec eax 401006: 75 fd jne 401005 <.text+0x5> 401008: c3 ret 401009: 90 nop 40100a: 90 nop 40100b: 90 nop ...