summaryrefslogtreecommitdiff
path: root/boot/x86_64/linker.ld
blob: b439380d7b87198befc47210e2951106a1a8a4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* x86_64 UEFI Loader Linker Script — ELF -> objcopy -> PE32+ */

ENTRY(efi_main)

SECTIONS
{
    . = 0;

    .text : { *(.text .text.*) }

    . = ALIGN(4096);
    .rodata : { *(.rodata .rodata.*) }

    . = ALIGN(4096);
    .data : { *(.data .data.*) *(.sdata .sdata.*) }

    . = ALIGN(4096);
    .bss : { *(.bss .bss.*) *(COMMON) }

    /*
        .reloc - empty PE base relocation sections. PE format requires this section to exist, even if empty.
        The aarch64 target doesn't need it explicitly. X86 does. TODO: i'm not sure about this!!!!
    */
    . = ALIGN(4096);
    .dynamic : { *(.dynamic) }
    .rela : { *(.rela .rela.*) }
    .reloc : { }

    /DISCARD/ : {
        *(.comment) *(.note.*) *(.eh_frame*) *(.gnu.hash) *(.hash)
    }
}