将NewLib移植到我的操作系统:一些问题

7

我正在尝试为我的操作系统移植NewLib(我正在遵循这个教程:http://wiki.osdev.org/Porting_Newlib),我有一些问题。

  • Once LibGloss is done and compiled, when exactly will I have to use the libnosys.a that have been created? Is it when I will compile my main.c?

    mipsel-uknown-elf-gcc main.c -Llibnosys.a`
    
  • My crt0.c is done. And I have to "link it as the first object". How can I do that? Is it something like this?

    mipsel-uknown-elf-ld crt0.o main.o
    
感谢您的回答!
1个回答

1

将链接器作为第一个对象进行连接可能会像您显示的那样正常工作,但文档中确实提到使用链接器脚本并添加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.

可能可以通过其他必须作为链接的系统库来实现相同的功能。

在命令行上添加所有内容是可以的,但最后有点繁琐。

你问这个是因为出现了错误或者结果不正确吗?


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接