Page 1 of 1

No Linker Needed?

Posted: Thu Dec 27, 2007 4:18 pm
by someprogr
Can anyone tell me why I was able to assemble this bootloader with NASM, and use it without linking it? I don't undertstand.

Heres the link:
http://www.osdever.net/tutorials/hello_btldr.php

Posted: Thu Dec 27, 2007 4:59 pm
by Combuster
NASM can "link" by itself

Posted: Fri Dec 28, 2007 6:02 am
by Craze Frog
A linker takes several object files in format X and combines them into one file in format Y. In your case you only had one object file and format X and Y was the same, so no linking was needed.

Posted: Fri Dec 28, 2007 9:11 pm
by Dex
Fasm can also link its self.

Posted: Mon Dec 31, 2007 10:29 am
by Red Shaya
A linker does as it name implies. It LINKS things between objects.
For example, it links a symbol with an actual address. So when you call the function "kprintf"

Code: Select all

    CALL _kprintf
the linker links the symbol "_printf" from your object with the pointer to the kprintf function in another object (its more complicated, but this simple explanation will do for what I'm trying to say).
When you write a bootloader, you don't refer to any symbolic object outside your bootloader. You just run a small piece of code that has all its references hard coded. For example

Code: Select all

    CALL 07D0h:0
So you don't need a linker to resolve any references.