thankfully. Also now using `ld` and `as` instead of `gcc` for everything. Seems to work OK for now - but may bite on the ass later. We'll see!
37 lines
1 KiB
Text
37 lines
1 KiB
Text
/*We have to write out this linker script so the linker knows where to put all the soup of stuff we put in start.s and main.c. i'll write out reasoning as i go. */
|
|
/*letting em know our entry point is actually label "start" in start.s, and not some function in the c file.*/
|
|
ENTRY(start)
|
|
SECTIONS
|
|
{
|
|
/*start me at 1Mb because below that is x86 essential stuff, which we dont want to be written on top of.*/
|
|
. = 2M;
|
|
|
|
/* we're going to maintain 4K alignment - apparently useful for paging, and i'm not complaining about the lost space anyway. */
|
|
|
|
/*our multiboot header from start.s - has to go at the beginning of the executable so the bootloader knows we're loadable.*/
|
|
/*executable section*/
|
|
.text BLOCK(4K) : ALIGN(4K)
|
|
{
|
|
*(.multiboot)
|
|
*(.text)
|
|
}
|
|
|
|
/*general read only data*/
|
|
.rodata BLOCK(4K) : ALIGN(4K)
|
|
{
|
|
*(.rodata*)
|
|
}
|
|
|
|
/*initialized rw data. */
|
|
.data BLOCK(4K) : ALIGN(4K)
|
|
{
|
|
*(.data)
|
|
}
|
|
|
|
/*uninitialized data, and our stack as defined in start.s*/
|
|
.bss BLOCK(4K) : ALIGN(4K)
|
|
{
|
|
*(COMMON)
|
|
*(.bss)
|
|
}
|
|
}
|