Porting NewLib for my OS: some questions
Asked Answered
R

1

7

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 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!

Reachmedown answered 8/8, 2010 at 11:44 Comment(0)
U
1

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?

Umpire answered 24/8, 2010 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.