Files
novaos/kernel/arch/link.ld

50 lines
1.1 KiB
Plaintext

/**
* 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
{
/*
* 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;
/*
* 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 */
{
text_start = .;
*(.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)
end_data = .;
}
/* BSS */
.bss BLOCK(4K) : ALIGN(4K)
{
sbss = .;
*(COMMON)
*(.bss)
ebss = .;
endkernel = .;
}
}