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