xv6-65oo2/kernel/kernel.ld
Anish Athalye f2ab0eb644 Clean up linker script
This patch does the following:

- Add .text.* to the .text section in the output
- Add an assertion that the trampoline does not overflow a page
- Add the .rodata section
- Make .sdata and .sdata.* (which is for small data) be absorbed into
  the .data section, because we don't need to distinguish between them;
  this prevents .sdata from appearing in the output
- Make the analogous change for .srodata and .sbss
- Make all the data sections 16-byte aligned

This patch also updates the .editorconfig for *.ld files.
2019-10-21 22:27:18 -04:00

45 lines
864 B
Plaintext

OUTPUT_ARCH( "riscv" )
ENTRY( _entry )
SECTIONS
{
/*
* ensure that entry.S / _entry is at 0x80000000,
* where qemu's -kernel jumps.
*/
. = 0x80000000;
.text : {
*(.text .text.*)
. = ALIGN(0x1000);
_trampoline = .;
*(trampsec)
. = ALIGN(0x1000);
ASSERT(. - _trampoline == 0x1000, "error: trampoline larger than one page");
PROVIDE(etext = .);
}
.rodata : {
. = ALIGN(16);
*(.srodata .srodata.*) /* do not need to distinguish this from .rodata */
. = ALIGN(16);
*(.rodata .rodata.*)
}
.data : {
. = ALIGN(16);
*(.sdata .sdata.*) /* do not need to distinguish this from .data */
. = ALIGN(16);
*(.data .data.*)
}
.bss : {
. = ALIGN(16);
*(.sbss .sbss.*) /* do not need to distinguish this from .bss */
. = ALIGN(16);
*(.bss .bss.*)
}
PROVIDE(end = .);
}