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
No Linker Needed?
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
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"
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
So you don't need a linker to resolve any references.
For example, it links a symbol with an actual address. So when you call the function "kprintf"
Code: Select all
CALL _kprintf
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