今天又看CS630[1]的Chapter 15,发现里头的一个例程manydots.s无法正常编译。
$ gcc manydots.s -o manydots
/tmp/ccIvmRVT.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../../lib/crt1.o:(.text+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
$ sed -i -e "s/_start/main/g" manydots.s
$ gcc manydots.s -o manydots
$ ./manydots
Segmentation fault
$ file manydots
manydots:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked<
$ gcc manydots.s -o manydots
/tmp/ccIvmRVT.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../../lib/crt1.o:(.text+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
$ sed -i -e "s/_start/main/g" manydots.s
$ gcc manydots.s -o manydots
$ ./manydots
Segmentation fault
$ file manydots
manydots:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked<