akaros/kern/arch/x86/kernel64.ld
<<
>>
Prefs
   1/* Simple linker script for the ROS kernel.
   2   See the GNU ld 'info' manual ("info ld") to learn the syntax. */
   3
   4/* This script needs to be invoked with -z max-page-size=0x1000.  Otherwise,
   5 * ld will offset our first section to 1MB within the actual file.  Multiboot
   6 * requires the header to be in the first two pages. */
   7
   8OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
   9ENTRY(_start)
  10KERN_LOAD_ADDR = 0xffffffffc0000000;
  11
  12SECTIONS
  13{
  14        /* Entry Linked and loaded at 0x00100000 (includes multiboot) */
  15        . = 0x00100000;
  16
  17        .bootstrap : {
  18                *(.boottext .bootdata .bootbss)
  19        }
  20
  21        /* Needed this for syslinux, which was sitting around 16MB phys.  This
  22         * just jumps us forward to the 32MB mark, both physically and
  23         * virtually. */
  24        . = 0x02000000;
  25
  26        /* Link the main kernel for the space after entry + KERN_LOAD_ADDR.
  27         * We'll still load it adjacent in physical memory */
  28        . += KERN_LOAD_ADDR;
  29
  30        .text : AT(ADDR(.text) - KERN_LOAD_ADDR) {
  31                *(.text .stub .text.* .gnu.linkonce.t.*)
  32                /* Define the 'etext' symbol to this value */
  33                PROVIDE(etext = .);
  34        }
  35
  36        INCLUDE kern/linker_tables.ld
  37        INCLUDE kern/build_id.ld
  38
  39        .rodata : {
  40                *(.rodata .rodata.* .gnu.linkonce.r.*)
  41        }
  42
  43        /* Adjust the address for the data segment to the next page */
  44        . = ALIGN(0x1000);
  45
  46        /* The data segment */
  47        .data : {
  48                *(.data)
  49        }
  50
  51        .bss : {
  52                PROVIDE(__start_bss = .);
  53                *(.bss)
  54                *(COMMON)
  55                PROVIDE(__stop_bss = .);
  56        }
  57
  58        /* 'end' isn't a real section, but everything needs a name.  It'll show
  59         * up as 'N' (debug) in the nm / ksyms.map output. */
  60        .end : {
  61                PROVIDE(end = .);
  62        }
  63
  64        /DISCARD/ : {
  65                *(.eh_frame .note.GNU-stack)
  66        }
  67}
  68