Untitled_Kernel/linker.ld
lordtet 472f91fe14 Started work on memory map, added printf features
Printf now has long (64-bit), char, and % literal support. I haven't written
anything specific for shorts yet but if you cast it to an int on the way
in, it'll work anyway, so whatever.
2025-07-05 04:36:39 -04:00

44 lines
1.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.*/
. = 1M;
_kernel_start = .;
/* 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*)
*(.gdt_sect)
*(.idtr)
}
/*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)
*(.idt)
}
_kernel_end = .;
}