Linking files
Posted: Mon Dec 10, 2007 10:44 am
Hello,
Yesterday, I restarted working on an OS. I thought it would be easier if I did'nt write a bootloader, and let grub do that work for me. And maybe start later with my own bootloader.
I found Bare bones and C PlusPlus bare bones
They were really helpful, and it's now working, but I don't understand how the linker script works:
The first line is the only one I understand (It tells the linker what function starts the program). Can someone explain the other lines?
Yesterday, I restarted working on an OS. I thought it would be easier if I did'nt write a bootloader, and let grub do that work for me. And maybe start later with my own bootloader.
I found Bare bones and C PlusPlus bare bones
They were really helpful, and it's now working, but I don't understand how the linker script works:
Code: Select all
ENTRY (_loader)
SECTIONS{
. = 0x00100000;
.text :{
*(.text)
}
.rodata ALIGN (0x1000) : {
*(.rodata)
}
.data ALIGN (0x1000) : {
*(.data)
}
.bss : {
_sbss = .;
*(COMMON)
*(.bss)
_ebss = .;
}
.data ALIGN (0x1000) : {
start_ctors = .;
*(.ctor*)
end_ctors = .;
start_dtors = .;
*(.dtor*)
end_dtors = .;
*(.data)
}
}