Files
rivos/kernel.ld

60 lines
1.2 KiB
Plaintext

/**
* This is the entry point
* `boot` should be a defined label
*/
ENTRY(boot)
/**
* SECTIONS tells to linker how to arrange sections inside the memory
*/
SECTIONS {
/**
* This is the base address (start address of the kernel)
* OpenSBI takes little ram
*/
. = 0x80200000;
/**
* This section contains the code of the program
*/
.text :{
/**
* Take the .text.boot before everything
* KEEP() prevents the linker to mark it as "unused"
*/
KEEP(*(.text.boot));
/**
* Include everything else inside the .text section
*/
*(.text .text.*);
}
/**
* Contains constant read-only data
* Align the start of the section at 4 byte
*/
.rodata : ALIGN(4) {
*(.rodata .rodata.*);
}
/**
* Contains read/write data
*/
.data : ALIGN(4) {
*(.data .data.*);
}
/**
* Contains read/data with an initial value of zero
*/
.bss : ALIGN(4) {
__bss = .;
*(.bss .bss.* .sbss .sbss.*);
__bss_end = .;
}
. = ALIGN(4);
. += 128 * 1024; /* 128KB */
__stack_top = .;
}