Wednesday, 15 February 2012

x86 - _start label with -nostdlib does not work -



x86 - _start label with -nostdlib does not work -

i've been trying debug 1 of code (x86) reads standard input , prints whatever content reads. code below works when compile , run with

gcc -o file file.s ./file < input > output

however, if create next changes , compile gcc -nostdlib -o file file.s command line argument

./file < input > output

no longer works. mean nil stored output file. thought why?

.global main -> .global _start main: -> _start

code:

.globl main main: movl $1, %edx jmp .l3 .l2: #write movl $4, %eax movl $1, %ebx int $0x80 .l3: #read movl $3, %eax movl $0, %ebx int $0x80 cmpl $0, %eax jne .l2

x86

No comments:

Post a Comment