I'm finally getting back to my colorforth project, which I gave up on years ago when an update to binutils broke all my sources. here's an example of what's happening:
jcomeau@aspire:~$ cat /tmp/test.as
.intel_syntax
.arch i386
.code32
mov eax,[foo + eax*4]
lea ecx,[ecx*4+0x9e0]
mov edx,DWORD PTR [edi*4-0x4]
jmp DWORD PTR [ecx*4+0x12cc]
lea edx,[ecx+edx*1]
the first non-directive line is from examples from the manual: https://sourceware.org/binutils/docs/as/i386_002dMemory.html#i386_002dMemory, and the rest are from an objdump disassembly with --disassembler-options=intel
. every single one fails to assemble:
jcomeau@aspire:~$ as /tmp/test.as
/tmp/test.as: Assembler messages:
/tmp/test.as:4: Error: too many memory references for `mov'
/tmp/test.as:5: Error: too many memory references for `lea'
/tmp/test.as:6: Error: too many memory references for `mov'
/tmp/test.as:8: Error: too many memory references for `lea'
/tmp/test.as:7: Error: invalid operands (*UND* and *ABS* sections) for `*'
I've been googling all evening with no luck. I'm sure I'm doing something wrong, but damned if I can figure out what it is. I've apt-get source binutils
, but don't know where to start looking.
jcomeau@aspire:~$ as --version
GNU assembler (GNU Binutils for Debian) 2.25.90.20151209
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `i686-linux-gnu'.
so what's the magic incantation to get cooking with gas
again?
When using GNU Assembler with the .intel_syntax
directive you'll want to use the noprefix
option to force AS to not require a %
(percent sign) to be prepended to register names (like AT&T syntax). You should probably use:
.intel_syntax noprefix