blob: 949b0d0e1beaae0bf4c1339b58c32d8a937a32f8 [file] [log] [blame]
/* Simple linker script for the ROS kernel.
See the GNU ld 'info' manual ("info ld") to learn the syntax. */
/* This script needs to be invoked with -z max-page-size=0x1000. Otherwise,
* ld will offset our first section to 1MB within the actual file. Multiboot
* requires the header to be in the first two pages. */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
ENTRY(_start)
KERN_LOAD_ADDR = 0xffffffffc0000000;
SECTIONS
{
/* Entry Linked and loaded at 0x00100000 (includes multiboot) */
. = 0x00100000;
.bootstrap : {
*(.boottext .bootdata .bootbss)
}
/* Needed this for syslinux, which was sitting around 16MB phys. This
* just jumps us forward to the 32MB mark, both physically and
* virtually. */
. = 0x02000000;
/* Link the main kernel for the space after entry + KERN_LOAD_ADDR.
* We'll still load it adjacent in physical memory */
. += KERN_LOAD_ADDR;
.text : AT(ADDR(.text) - KERN_LOAD_ADDR) {
*(.text .stub .text.* .gnu.linkonce.t.*)
/* Define the 'etext' symbol to this value */
PROVIDE(etext = .);
}
INCLUDE kern/linker_tables.ld
INCLUDE kern/build_id.ld
.rodata : {
*(.rodata .rodata.* .gnu.linkonce.r.*)
}
/* Adjust the address for the data segment to the next page */
. = ALIGN(0x1000);
/* The data segment */
.data : {
*(.data)
}
.bss : {
PROVIDE(__start_bss = .);
*(.bss)
*(COMMON)
PROVIDE(__stop_bss = .);
}
/* 'end' isn't a real section, but everything needs a name. It'll show
* up as 'N' (debug) in the nm / ksyms.map output. */
.end : {
PROVIDE(end = .);
}
/DISCARD/ : {
*(.eh_frame .note.GNU-stack)
}
}