【问题标题】:Porting NewLib for my OS: some questions为我的操作系统移植 NewLib:一些问题
【发布时间】:2011-03-26 22:31:51
【问题描述】:

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

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

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

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

感谢您的回答!

【问题讨论】:

    标签: c gcc ld newlib


    【解决方案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.
    

    对于总是必须成为链接一部分的其他系统库,可能也可以这样做。

    在命令行中全部添加也可以,但最后有点繁琐。

    您是否收到任何错误或错误的结果,因为您正在询问或什么?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-16
      • 2011-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-21
      • 2015-06-17
      • 1970-01-01
      相关资源
      最近更新 更多