开发者

Porting NewLib for my OS: some questions

I am trying to port NewLib for my OS (I am following this tutorial: http://wiki.osdev.org/Porting_Newlib), and I have some questions.

  • Once LibGloss is done and compiled, when exactly will I have 开发者_StackOverflow社区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
    

Thanks for your answers!


Linking as the first object might work just fine like you are displaying, but the docs does mention using a linker script and adding crt0.o as STARTUP() -- I'm not too familiar with linker scripts, but you can find the default linker script and possibly create it/adjust it:

Syntax of linking script: 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.

The same can probably be done with other system libraries that always have to be part of the linking.

It's fine to add all on the command line, but a bit tedious in the end.

Are you getting any errors or wrong results since you are asking or what?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜