xv6-riscv-kernel/kernel/kernel.ld

79 lines
2.2 KiB
Text
Raw Normal View History

2019-05-31 15:45:59 +02:00
OUTPUT_ARCH( "riscv" )
ENTRY( _entry )
2011-08-07 18:30:34 +02:00
SECTIONS
{
2019-05-31 15:45:59 +02:00
/*
* ensure that entry.S / _entry is at 0x80000000,
* where qemu's -kernel jumps.
*/
. = 0x80000000;
/*
* This section contains the code. This is, the machine language instructions
* that will be executed by the processor. In here we will find symbols
* that reference the functions in your object file.
*/
.text : {
2024-08-09 07:59:03 +02:00
/* Match any section that starts with .text. */
*(.text .text.*)
2024-08-09 07:59:03 +02:00
/* Align the next section to a 4KB (page) boundary. */
2019-05-31 15:45:59 +02:00
. = ALIGN(0x1000);
2024-08-09 07:59:03 +02:00
/* Put the trampoline code here. */
_trampoline = .;
2024-08-09 07:59:03 +02:00
/* Match any section that starts with .trampsec. */
2019-07-26 10:53:46 +02:00
*(trampsec)
2024-08-09 07:59:03 +02:00
/* Align the next section to a 4KB (page) boundary. */
. = ALIGN(0x1000);
2024-08-09 07:59:03 +02:00
/* Assert that the trampoline code is exactly 4KB (page) in size. */
ASSERT(. - _trampoline == 0x1000, "error: trampoline larger than one page");
2024-08-09 07:59:03 +02:00
/* Define symbol etext to be the current location. */
PROVIDE(etext = .);
2019-05-31 15:45:59 +02:00
}
2011-08-07 18:30:34 +02:00
/*
* This contains any data that is marked as read only.
* It is not unusual to find this data interleaved with the text section.
*/
.rodata : {
2024-08-09 07:59:03 +02:00
/* Align on quadword boundary. */
. = ALIGN(16);
*(.srodata .srodata.*) /* do not need to distinguish this from .rodata */
. = ALIGN(16);
*(.rodata .rodata.*)
}
2011-08-07 18:30:34 +02:00
/*
* This section contains initialized global and static variables.
* Any global object that has been explicitly initialized to a value different than zero.
*/
2019-05-31 15:45:59 +02:00
.data : {
. = ALIGN(16);
*(.sdata .sdata.*) /* do not need to distinguish this from .data */
. = ALIGN(16);
*(.data .data.*)
2019-05-31 15:45:59 +02:00
}
/*
* Contains all uninitialized global and static var iables. These are usually
* zeroed out by the startup code before we reach the main function. However,
* In an embedded system we usually provide our own startup code, which means
* we need to remember to do this ourselves.
*/
2019-09-08 12:51:58 +02:00
.bss : {
. = ALIGN(16);
*(.sbss .sbss.*) /* do not need to distinguish this from .bss */
. = ALIGN(16);
*(.bss .bss.*)
2019-05-31 15:45:59 +02:00
}
2024-08-09 07:59:03 +02:00
/* Define symbol end as current location, note that this is not aligned, see vm.c */
PROVIDE(end = .);
2011-08-07 18:30:34 +02:00
}