I was trying to run the first example(exit.s) in Programming from Ground Up,
i.e.
.section .data
.section .text
.globl _start
_start:
movl $1 , %eax
movl $2 , %ebx
int $0x80
I compile and run using:
as exit.s -o exit.o;ld exit.o -o exit ; ./exit
This results in a segmentation fault , no matter what I do
but when i add the two extra lines(allocating a long/word/byte in the memory) as below, the program works fine
.section .data
data:
.long 1
.section .text
.globl _start
_start:
movl $1 , %eax
movl $2 , %ebx
int $0x80
Has it something to do with assembler version , like the book being out of sync with the latest in as , i am just a beginner so forgive me if what i guess is naive.
linux:~/XML/Grid/source # as -v
GNU assembler version 2.16.91.0.2 (i586-suse-linux) using BFD version 2.16.91.0.2 20050720 (SuSE Linux)
Digz ( Please cc to my ID as I am not a member of the list)
| **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
_______________________________________________ Pgubook-readers mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/pgubook-readers
