How can I use Gas ('as') to assemble source to a 32 bit binary on 64 bit Linux?
This is for the purpose of following 32 bit tutorials without the hassle of having to change all the pointers and lots of instructions to quad words.
Thanks,
Chris.
P.S. I can easily do this in C...
chris@chris-linux-desktop:~$ cat test.c
#include "stdio.h"
int main() {
printf("hello world");
return 0;
}
chris@chris-linux-desktop:~$ gcc test.c -o test64
chris@chris-linux-desktop:~$ gcc -m32 test.c -o test32
chris@chris-linux-desktop:~$ file test32
test32: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
chris@chris-linux-desktop:~$ file test64
test64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
--32
or use-m32
with gcc – user786653 Oct 28 '11 at 9:28