pimpampoum
pimpampoum

Reputation: 5994

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.

Thanks for your answers!

Upvotes: 7

Views: 1295

Answers (1)

nicomen
nicomen

Reputation: 1203

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?

Upvotes: 1

Related Questions