adds some comments, fixes a few tiny bugs

This commit is contained in:
2025-05-31 20:50:47 -04:00
parent c50d3f14a6
commit 89c02d6a93
3 changed files with 56 additions and 8 deletions

View File

@ -1,25 +1,41 @@
ENTRY(loader)
/**
* This is the linker file.
*
* This file tells the linker (ld) how we want to arrange the code into the output file.
*/
ENTRY(loader) /* This is the first entry point, defined in boot.s */
SECTIONS
{
. = 1M;
/*
* This is telling the linker that anything after here should be loaded at 2M onwards
* The reason for 2M, is that we want to give room for the BIOS, (and UEFI), 2M is generally regarded as a safe spot
* to place the memory offset
* */
. = 2M;
.text BLOCK(4K) : ALIGN(4K)
/*
* BLOCK is an alias for ALIGN, we're telling the linker that we want each section to be aligned at 4K
*/
.text BLOCK(4K) : ALIGN(4K) /* The first section we want is the text section, this is where most code is */
{
*(.multiboot)
*(.text)
*(.multiboot) /* Multiboot needs to be early in the file, required by grub */
*(.text) /* The text section */
}
/* R/O data */
.rodata BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
}
/* Data */
.data BLOCK(4K) : ALIGN(4K)
{
*(.data)
}
/* BSS */
.bss BLOCK(4K) : ALIGN(4K)
{
*(COMMON)