1/* Script for -pie -z combreloc */ 2/* Copyright (C) 2014-2021 Free Software Foundation, Inc. 3 Copying and distribution of this script, with or without modification, 4 are permitted in any medium without royalty provided the copyright 5 notice and this notice are preserved. */ 6OUTPUT_FORMAT("elf32-bigarm", "elf32-bigarm", 7 "elf32-littlearm") 8OUTPUT_ARCH(arm) 9ENTRY(_start) 10SEARCH_DIR("=/aarch64-none-linux-gnu/lib"); 11SECTIONS 12{ 13 /* Read-only sections, merged into text segment: */ 14 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0)); . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS; 15 .interp : { *(.interp) } 16 .note.gnu.build-id : { *(.note.gnu.build-id) } 17 .hash : { *(.hash) } 18 .gnu.hash : { *(.gnu.hash) } 19 .dynsym : { *(.dynsym) } 20 .dynstr : { *(.dynstr) } 21 .gnu.version : { *(.gnu.version) } 22 .gnu.version_d : { *(.gnu.version_d) } 23 .gnu.version_r : { *(.gnu.version_r) } 24 .rel.dyn : 25 { 26 *(.rel.init) 27 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) 28 *(.rel.fini) 29 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 30 *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) 31 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) 32 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) 33 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) 34 *(.rel.ctors) 35 *(.rel.dtors) 36 *(.rel.got) 37 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) 38 *(.rel.iplt) 39 } 40 .rela.dyn : 41 { 42 *(.rela.init) 43 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 44 *(.rela.fini) 45 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 46 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 47 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 48 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 49 *(.rela.ctors) 50 *(.rela.dtors) 51 *(.rela.got) 52 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 53 *(.rela.iplt) 54 } 55 .rel.plt : 56 { 57 *(.rel.plt) 58 } 59 .rela.plt : 60 { 61 *(.rela.plt) 62 } 63 .init : 64 { 65 KEEP (*(SORT_NONE(.init))) 66 } 67 .plt : { *(.plt) } 68 .iplt : { *(.iplt) } 69 .text : 70 { 71 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 72 *(.text.exit .text.exit.*) 73 *(.text.startup .text.startup.*) 74 *(.text.hot .text.hot.*) 75 *(SORT(.text.sorted.*)) 76 *(.text .stub .text.* .gnu.linkonce.t.*) 77 /* .gnu.warning sections are handled specially by elf.em. */ 78 *(.gnu.warning) 79 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) 80 } 81 .fini : 82 { 83 KEEP (*(SORT_NONE(.fini))) 84 } 85 PROVIDE (__etext = .); 86 PROVIDE (_etext = .); 87 PROVIDE (etext = .); 88 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 89 .rodata1 : { *(.rodata1) } 90 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } 91 .ARM.exidx : 92 { 93 PROVIDE_HIDDEN (__exidx_start = .); 94 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 95 PROVIDE_HIDDEN (__exidx_end = .); 96 } 97 .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } 98 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } 99 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } 100 .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } 101 /* These sections are generated by the Sun/Oracle C++ compiler. */ 102 .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) } 103 /* Adjust the address for the data segment. We want to adjust up to 104 the same address within the page on the next page up. */ 105 . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)); 106 /* Exception handling */ 107 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } 108 .gnu_extab : ONLY_IF_RW { *(.gnu_extab) } 109 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 110 .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) } 111 /* Thread Local Storage sections */ 112 .tdata : 113 { 114 PROVIDE_HIDDEN (__tdata_start = .); 115 *(.tdata .tdata.* .gnu.linkonce.td.*) 116 } 117 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 118 .preinit_array : 119 { 120 PROVIDE_HIDDEN (__preinit_array_start = .); 121 KEEP (*(.preinit_array)) 122 PROVIDE_HIDDEN (__preinit_array_end = .); 123 } 124 .init_array : 125 { 126 PROVIDE_HIDDEN (__init_array_start = .); 127 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 128 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) 129 PROVIDE_HIDDEN (__init_array_end = .); 130 } 131 .fini_array : 132 { 133 PROVIDE_HIDDEN (__fini_array_start = .); 134 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 135 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) 136 PROVIDE_HIDDEN (__fini_array_end = .); 137 } 138 .ctors : 139 { 140 /* gcc uses crtbegin.o to find the start of 141 the constructors, so we make sure it is 142 first. Because this is a wildcard, it 143 doesn't matter if the user does not 144 actually link against crtbegin.o; the 145 linker won't look for a file to match a 146 wildcard. The wildcard also means that it 147 doesn't matter which directory crtbegin.o 148 is in. */ 149 KEEP (*crtbegin.o(.ctors)) 150 KEEP (*crtbegin?.o(.ctors)) 151 /* We don't want to include the .ctor section from 152 the crtend.o file until after the sorted ctors. 153 The .ctor section from the crtend file contains the 154 end of ctors marker and it must be last */ 155 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 156 KEEP (*(SORT(.ctors.*))) 157 KEEP (*(.ctors)) 158 } 159 .dtors : 160 { 161 KEEP (*crtbegin.o(.dtors)) 162 KEEP (*crtbegin?.o(.dtors)) 163 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 164 KEEP (*(SORT(.dtors.*))) 165 KEEP (*(.dtors)) 166 } 167 .jcr : { KEEP (*(.jcr)) } 168 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 169 .dynamic : { *(.dynamic) } 170 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) } 171 .data : 172 { 173 __data_start = .; 174 *(.data .data.* .gnu.linkonce.d.*) 175 SORT(CONSTRUCTORS) 176 } 177 .data1 : { *(.data1) } 178 _edata = .; PROVIDE (edata = .); 179 /* This section contains data that is initialized during load, 180 but not during the application's initialization sequence. */ 181 .persistent : 182 { 183 . = ALIGN(32 / 8); 184 PROVIDE (__persistent_start = .); 185 *(.persistent .persistent.* .gnu.linkonce.p.*) 186 . = ALIGN(32 / 8); 187 PROVIDE (__persistent_end = .); 188 } 189 . = .; 190 __bss_start = .; 191 __bss_start__ = .; 192 .bss : 193 { 194 *(.dynbss) 195 *(.bss .bss.* .gnu.linkonce.b.*) 196 *(COMMON) 197 /* Align here to ensure that the .bss section occupies space up to 198 _end. Align after .bss to ensure correct alignment even if the 199 .bss section disappears because there are no input sections. 200 FIXME: Why do we need it? When there is no .bss section, we do not 201 pad the .data section. */ 202 . = ALIGN(. != 0 ? 32 / 8 : 1); 203 } 204 _bss_end__ = .; __bss_end__ = .; 205 /* This section contains data that is not initialized during load, 206 or during the application's initialization sequence. */ 207 .noinit (NOLOAD) : 208 { 209 . = ALIGN(32 / 8); 210 PROVIDE (__noinit_start = .); 211 *(.noinit .noinit.* .gnu.linkonce.n.*) 212 . = ALIGN(32 / 8); 213 PROVIDE (__noinit_end = .); 214 } 215 . = ALIGN(32 / 8); 216 . = SEGMENT_START("ldata-segment", .); 217 . = ALIGN(32 / 8); 218 __end__ = .; 219 _end = .; PROVIDE (end = .); 220 .stack 0x80000 : 221 { 222 _stack = .; 223 *(.stack) 224 } 225 /* Stabs debugging sections. */ 226 .stab 0 : { *(.stab) } 227 .stabstr 0 : { *(.stabstr) } 228 .stab.excl 0 : { *(.stab.excl) } 229 .stab.exclstr 0 : { *(.stab.exclstr) } 230 .stab.index 0 : { *(.stab.index) } 231 .stab.indexstr 0 : { *(.stab.indexstr) } 232 .comment 0 : { *(.comment) } 233 .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } 234 /* DWARF debug sections. 235 Symbols in the DWARF debugging sections are relative to the beginning 236 of the section so we begin them at 0. */ 237 /* DWARF 1. */ 238 .debug 0 : { *(.debug) } 239 .line 0 : { *(.line) } 240 /* GNU DWARF 1 extensions. */ 241 .debug_srcinfo 0 : { *(.debug_srcinfo) } 242 .debug_sfnames 0 : { *(.debug_sfnames) } 243 /* DWARF 1.1 and DWARF 2. */ 244 .debug_aranges 0 : { *(.debug_aranges) } 245 .debug_pubnames 0 : { *(.debug_pubnames) } 246 /* DWARF 2. */ 247 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 248 .debug_abbrev 0 : { *(.debug_abbrev) } 249 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } 250 .debug_frame 0 : { *(.debug_frame) } 251 .debug_str 0 : { *(.debug_str) } 252 .debug_loc 0 : { *(.debug_loc) } 253 .debug_macinfo 0 : { *(.debug_macinfo) } 254 /* SGI/MIPS DWARF 2 extensions. */ 255 .debug_weaknames 0 : { *(.debug_weaknames) } 256 .debug_funcnames 0 : { *(.debug_funcnames) } 257 .debug_typenames 0 : { *(.debug_typenames) } 258 .debug_varnames 0 : { *(.debug_varnames) } 259 /* DWARF 3. */ 260 .debug_pubtypes 0 : { *(.debug_pubtypes) } 261 .debug_ranges 0 : { *(.debug_ranges) } 262 /* DWARF 5. */ 263 .debug_addr 0 : { *(.debug_addr) } 264 .debug_line_str 0 : { *(.debug_line_str) } 265 .debug_loclists 0 : { *(.debug_loclists) } 266 .debug_macro 0 : { *(.debug_macro) } 267 .debug_names 0 : { *(.debug_names) } 268 .debug_rnglists 0 : { *(.debug_rnglists) } 269 .debug_str_offsets 0 : { *(.debug_str_offsets) } 270 .debug_sup 0 : { *(.debug_sup) } 271 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 272 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 273 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 274} 275