I am trying to compile an asm program on a linux server. I am new to writing asm programs, but I follow my school's tutorial and do everything they say but it has no success.
Here is my hello.asm file.
SECTION .data
msg: db "Hello World",10
len: equ $-msg
SECTION .text
global main
main:
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov ebx,0
mov eax,1
int 0x80
I compile this file using the command line nasm -f elf hello.asm
which works completely fine and generates an object file. The problem is, when I try ld hello.o
, it says that it cannot read symbols in the file and the file is in the wrong format.
Can anyone help me and tell me how I can compile a .asm file so it can run?