(oops, I just looked at the question and thought that you are making a standalone executable with only ld . See the cad answer for gcc -m32 , because when you want to connect to libc and all this, and not just try a little experiment as standalone .)
You must tell ld which machine you want to work on. By default, a native type is used.
nasm -f elf32 array1.asm # or yasm ld -m elf_i386 array1.o -o 32bit-array1
Unfortunately, most asm manuals / resources still have examples with 32-bit x86 code.
source share