2010-08-08 42 views
7

我想为我的操作系统移植NewLib(我正在学习本教程:http://wiki.osdev.org/Porting_Newlib),并且我有一些问题。移植我的操作系统的NewLib:一些问题

  • 一旦LibGloss完成并编译完成,何时必须使用已创建的libnosys.a?是什么时候我会编译我的main.c?

    mipsel-uknown-elf-gcc main.c -Llibnosys.a` 
    
  • 我的crt0.c完成了。我必须“将它作为第一个对象”。我怎样才能做到这一点?是这样的吗?

    mipsel-uknown-elf-ld crt0.o main.o 
    

谢谢您的回答!

回答

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. 

同样大概可以与其他系统库日完成总是必须成为链接的一部分。

在命令行中添加所有内容很好,但最后有点乏味。

你是否因为问什么或是什么而得到任何错误或错误的结果?