我正在尝试为我的操作系统移植NewLib(我正在关注本教程:http://wiki.osdev.org/Porting_Newlib),我有一些问题。
mipsel-uknown-elf-gcc main.c -Llibnosys.a`
mipsel-uknown-elf-ld crt0.o main.o
谢谢你的回答!
链接作为第一个对象可能正常工作,就像你正在显示,但文档确实提到使用链接器脚本并添加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.
对于总是必须成为链接一部分的其他系统库,可能也是如此。
可以在命令行中添加all,但最后有点乏味。
你问的问题或者是什么,你得到任何错误或错误的结果吗?