I am learning assembly from the book Programming from the ground up. I typed together the first program they listed, exit.s:
Code:
.section .data
.section .txt
.globl _start
_start:
movl $1, %eax # this is the linux kernel command number (system call) for
# exiting a program
movl $0, %ebx # this is the status number we will return to the operating
# system. change this around and it will return different
# different things to "echo $?"
int $0x80 # this wakes up the kernel to run the exit command
I assemble, and link it:
Code:
bash-3.1$ as exit.s -o exit.o
bash-3.1$ ld exit.o -o exit
Then I try to execute it:
Code:
bash-3.1$ ./exit
bash: ./exit: cannot execute binary file
I was searching on google for this error, but no luck.
I am running slackware 12, have an HP laptop with an intel processor, if that helps.
So, does anyone have any ideas on how to solve this?