Skip to content
Snippets Groups Projects
x86_64.ld 1.07 KiB
Newer Older
ENTRY(kstart)
OUTPUT_FORMAT(elf64-x86-64)

KERNEL_OFFSET = 0xFFFFFFFF80000000;

SECTIONS {
    . = KERNEL_OFFSET;

    . += SIZEOF_HEADERS;

    .text ALIGN(4K) : AT(ADDR(.text) - KERNEL_OFFSET) {
        __text_start = .;
        *(.text*)
Jacob Lorentzon's avatar
Jacob Lorentzon committed
        __usercopy_start = .;
        *(.usercopy-fns)
        __usercopy_end = .;
    .rodata ALIGN(4K) : AT(ADDR(.rodata) - KERNEL_OFFSET) {
        __text_end = .;
        __rodata_start = .;
        *(.rodata*)
        __altcode_start = .;
        *(.altcode)
        __altcode_end = .;
        __altrelocs_start = .;
        *(.altrelocs)
        __altrelocs_end = .;
        __altfeatures_start = .;
        *(.altfeatures)
        __altfeatures_end = .;
    .data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET) {
        __rodata_end = .;
        __data_start = .;
        *(.data*)
    }

    __end = .;

    /DISCARD/ : {
        *(.comment*)
        *(.eh_frame*)
        *(.gcc_except_table*)
        *(.note*)
        *(.rel.eh_frame*)
    }
}