Open ghost opened 8 years ago
out.s:
.text
.global _start
_start:
movl $0, %ebx
movl $1, %eax
int $0x80
The compiler emits 32-bit code (i386), not code for x86-64 . You must be explicit on the type of generated format.
$ as --32 -g -o out.o out.s
$ ld -m elf_i386 -e _start -g -o a.out out.o
$ file ./a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
ld -s -o out out.o
creates these warnings:Warnings aren't inherently bad, but the next step:
./out
fails with./out: No such file or directory