??????????????????????????????????????????????????????????????????????????
# Here's the file we want to compile.
$ cat return_two.c
#include <stdio.h>
int main() {
return 2;
}
# Run the compiler with this file.
$ ./babyc return_two.c
Written out.s.
# Check the output looks sensible.
$ cat out.s
.text
.global _start
_start:
movl    $2?? %ebx
movl    $1?? %eax
int     $0x80
??????????????????????????????????±?????????????????????????????????
# Assemble the file. We explicitly assemble as 32-bit
# to avoid confusion on x86_64 machines.
$ as out.s -o out.o --32
# Link the file?? again specifying 32-bit.
$ ld -m elf_i386 -s -o out out.o
# Run it!
$ ./out
# What was the return code?
$ echo $?
2 # Woohoo!
??????????????????????????????????????????????????????????????????飬???????????????????????????????д????????????????????????????????????????????1????????????????????磬return 3; ?Щ????д???????2??????“??”?????????磬return ??1; ?Щ????д?????????????????????????????C?????????????????????????????е?????????????????д???????????????????
??????????? babyc ???????Babyc ????????????if???????????????????????????????????check out???????????????????????????????????????д?????
??????????μ????Щ???顣??????????????????硣