45 lines
1008 B
Plaintext
45 lines
1008 B
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 */
|
|
{
|
|
*(.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)
|
|
*(.bss)
|
|
}
|
|
}
|