I found "hello world" and wrote it. nano hello.s
this code
.data
msg:
.string "Hello, world!\n"
len = . - msg
.text
global _start
_start:
movl $len,%edx
movl $msg,%ecx
movl $1,%ebx
movl $4,%eax
int $0x80
movl $0,%ebx
movl $1,%eax
int $0x80
I've done as -o hello.o hello.s
I've given an error
hello.s:6: Error: no such instruction: global _start
delete global _start.
I've done
ld -s -o hello.o hello*
error
ld: hello: No such file: No such file or directory
Where am I mistaking?
p/s debian, amd64.
Try .globl _start
or .global _start
.
You may try ununderscored start
in case you run into a problem with the entry point.
Finally, if you're making a 64-bit executable, you probably need to use a different system call interface, not int 0x80
but syscall
. More on that here.