Linkers

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
OS

Linkers

Post by OS »

Hello,
Where to start learning linkers and how to write a linking script?
Thanks.
paulbarker

Re:Linkers

Post by paulbarker »

If you're using a GNU toolchain:

Code: Select all

info ld
Or go to www.gnu.org and search for binutils.

If not, please tell us which linker you are using...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Linkers

Post by Pype.Clicker »

or check the FAQ. You might have a good bootstrap :P

<edit> just added HowLinkersWork to the FAQ, just in case you're missing an introduction to the subject.

For the rest, the "linker scripts" section of "info ld" should do the trick, really ...
OS

Re:Linkers

Post by OS »

Thanks for your reply with usefull info.
Can I use:

Code: Select all

$ nasm -f elf kernel.asm
$ ld -s -o kernel kernel.o
to produce my excutable kernel with out writting a linkscript?

Pype.Clicker, its grub bootloader :)
paulbarker

Re:Linkers

Post by paulbarker »

Why not try it and see what happens? Don't be afraid of playing around as long as you are testing using an emulator or dedicated machine (be careful if testing on a machine which has valuable data).

There are 2 options you do want though: "-nostdlib" and "-e (entry function)". Check the docs, think, and you should understand why.
Post Reply