Compiling 32 bit assembly on 64bit system (Ubuntu)
assembly
Solution
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
Problem
I'm trying to learn about assembly with the book "Programming from the ground up". The book covers only 32 bit instructions. Is there a way to run the example codes on 64 bit Ubuntu system? I can't understand the stuff on the man page of the GNU assembler but I heard the `-m32` flag should do it. But it's not a recognized option. How do I get the examples on the book to work with ease?