| git.druid.rocks | index | druid520 | kaboom | linker.ld |
linker.ld
/*
* load at the classic 1MiB mark so bios/legacy memory below it is
* never touched. boot.s's PVH note (see the comment there for why
* PVH and not multiboot1) points at _start's real runtime address
* directly, so there's no header-placement constraint to satisfy
* here the way multiboot1 would have had.
*/
ENTRY(_start)
SECTIONS
{
. = 0x100000;
.note.pvh : {
*(.note.pvh)
}
.text : {
*(.text)
}
/* page-align before rodata/data so the linker splits these into
* separate LOAD segments with the right permissions instead of
* merging everything into one RWX segment (its default when
* differently-flagged sections aren't segment-boundary-aligned) --
* text stays R+X only, everything from here down is R+W, never X. */
. = ALIGN(4096);
.rodata : {
*(.rodata)
}
.data : {
*(.data)
}
.bss : {
_bss_start = .;
*(COMMON)
*(.bss)
/* dword-align the end: boot.s zeroes this range with rep
* stosl, whose count is (end - start) / 4. */
. = ALIGN(4);
_bss_end = .;
}
. = ALIGN(4096);
_end = .;
}