So I've been trying to learn x86 assembly with nasm
. The operating System is ubuntu, using WSL2
. I would assemble my file as shown here:
nasm -f elf32 file.asm
no errors, so I would link it with ld
, like this:
ld -m elf_i386 -o file file.o
no errors again, but when I run the executable produced(./file
), I get the following error:
-bash: ./asm01: cannot execute binary file: Exec format error
I've been stuck for a while now. I know that my code I've written has no errors, as I tested it on an online assembler, so I dont know what the problem is.