1
我想在沒有GLIBC的情況下編譯時從main()返回一個值,但它不起作用。讓我們這個例子中,我的互聯網上找到:從main()返回沒有glibc的值
[[email protected] tests]$ cat stubstart.S
.globl _start
_start:
call main
movl $1, %eax
xorl %ebx, %ebx
int $0x80
[[email protected] tests]$ cat m.c
int main(int argc,char **argv) {
return(90);
}
[[email protected] tests]$ gcc -nostdlib stubstart.S -o m m.c
[[email protected] tests]$ ./m
[[email protected] tests]$ echo $?
0
[[email protected] tests]$
現在,如果我用glibc編譯我得到的返回值就好:
[[email protected] tests]$ gcc -o mglibc m.c
[[email protected] tests]$ ./mglibc
[[email protected] tests]$ echo $?
90
[[email protected] tests]$
所以,aparently返回不正確stubstart完成。 S,我該怎麼做纔對? (僅適用於Linux)