链接作为第一个对象可能就像您显示的那样工作得很好,但是文档确实提到了使用链接器脚本并将 crt0.o 添加为 STARTUP() - 我对链接器脚本不太熟悉,但您可以找到默认值链接器脚本并可能创建/调整它:
链接脚本的语法:http ://wiki.osdev.org/Linker_Scripts
http://sourceware.org/binutils/docs-2.19/ld/Scripts.html#Scripts
The linker always uses a linker script. If you do not supply one yourself, the linker
will use a default script that is compiled into the linker executable. You can use the
`--verbose' command line option to display the default linker script. Certain command
line options, such as `-r' or `-N', will affect the default linker script.
对于总是必须成为链接一部分的其他系统库,可能也可以这样做。
在命令行中添加所有内容很好,但最后有点乏味。
自从您提出问题后,您是否收到任何错误或错误的结果?