When your assembler and linker are x86_64 versions, the options to produce i386 (32-bit) output are
as --32
ld -m elf_i386
You don’t have to use as
and ld
just because you’re working with assembly code. gcc
can be used, and in that case you would use -m32
.
gcc -m32 -nostdlib myprog.s -o myprog