/* $OpenBSD: kern.ldscript,v 1.4 2017/01/23 14:11:21 kettenis Exp $ */ /* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ */ OUTPUT_ARCH(aarch64) /* Define how we want our ELF binary to look like. */ PHDRS { text PT_LOAD; rodata PT_LOAD; data PT_LOAD; openbsd_randomize PT_OPENBSD_RANDOMIZE; } __ALIGN_SIZE = 0x1000; __kernel_base = @KERNEL_BASE_VIRT@; ENTRY(_start) SECTIONS { . = __kernel_base; .text : { *(.text .text.*) *(.stub) *(.glue_7t) *(.glue_7) } :text =0 PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); /* Move rodata to the next page, so we can nuke X and W bit on it */ . = ALIGN(__ALIGN_SIZE); .rodata : { *(.rodata .rodata.*) } :rodata PROVIDE (erodata = .); _erodata = .; /* Move .random to the next page, so we can add W bit on it and .data */ . = ALIGN(__ALIGN_SIZE); .openbsd.randomdata : { *(.openbsd.randomdata) } :openbsd_randomize :data .data : { *(.data .data.*) } :data .sdata : { *(.sdata .sdata.*) } :data PROVIDE (edata = .); _edata = .; PROVIDE (__bss_start = .); .sbss : { *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) } :data .bss : { *(.dynbss) *(.bss) *(.bss.*) *(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ . = ALIGN(64 / 8); } :data PROVIDE (end = .); _end = .; }