1/* $OpenBSD: kern.ldscript,v 1.4 2018/03/08 20:44:23 patrick Exp $ */ 2/* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ */ 3 4OUTPUT_ARCH(arm) 5 6/* Define how we want our ELF binary to look like. */ 7PHDRS 8{ 9 text PT_LOAD; 10 rodata PT_LOAD FLAGS (4); 11 data PT_LOAD; 12 openbsd_randomize PT_OPENBSD_RANDOMIZE; 13} 14 15__ALIGN_SIZE = 0x1000; 16__kernel_base = @KERNEL_BASE_VIRT@; 17 18ENTRY(bootstrap_start) 19SECTIONS 20{ 21 . = __kernel_base; 22 PROVIDE (__text_start = .); 23 .text : 24 { 25 *(.text .text.*) 26 *(.stub) 27 *(.glue_7t) *(.glue_7) 28 } :text =0 29 PROVIDE (_etext = .); 30 PROVIDE (etext = .); 31 32 /* Move rodata to the next page, so we can nuke X and W bit on it */ 33 . = ALIGN(__ALIGN_SIZE); 34 PROVIDE (__rodata_start = .); 35 .rodata : 36 { 37 *(.rodata .rodata.*) 38 } :rodata 39 .openbsd.randomdata : 40 { 41 *(.openbsd.randomdata) 42 } :openbsd_randomize :rodata 43 PROVIDE (_erodata = .); 44 45 /* Move .data to the next page, so we can add W bit on it */ 46 . = ALIGN(__ALIGN_SIZE); 47 PROVIDE (__data_start = .); 48 .data : 49 { 50 *(.data .data.*) 51 } :data 52 .sdata : 53 { 54 *(.sdata .sdata.*) 55 } :data 56 PROVIDE (_edata = .); 57 58 PROVIDE (__bss_start = .); 59 .sbss : 60 { 61 *(.dynsbss) 62 *(.sbss) 63 *(.sbss.*) 64 *(.scommon) 65 } :data 66 .bss : 67 { 68 *(.dynbss) 69 *(.bss) 70 *(.bss.*) 71 *(COMMON) 72 /* Align here to ensure that the .bss section occupies space up to 73 _end. Align after .bss to ensure correct alignment even if the 74 .bss section disappears because there are no input sections. */ 75 . = ALIGN(32 / 8); 76 } :data 77 . = ALIGN(32 / 8); 78 PROVIDE (_end = .); 79 PROVIDE (end = .); 80 /DISCARD/ : 81 { 82 *(.ARM.exidx) 83 } 84} 85 86