1/* Script for -shared -z combreloc -z separate-code */ 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-bigaarch64", "elf32-bigaarch64", 7 "elf32-littleaarch64") 8OUTPUT_ARCH(aarch64:ilp32) 9ENTRY(_start) 10SEARCH_DIR("=/aarch64-none-linux-gnu/lib"); 11SECTIONS 12{ 13 . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS; 14 .note.gnu.build-id : { *(.note.gnu.build-id) } 15 .hash : { *(.hash) } 16 .gnu.hash : { *(.gnu.hash) } 17 .dynsym : { *(.dynsym) } 18 .dynstr : { *(.dynstr) } 19 .gnu.version : { *(.gnu.version) } 20 .gnu.version_d : { *(.gnu.version_d) } 21 .gnu.version_r : { *(.gnu.version_r) } 22 .rela.dyn : 23 { 24 *(.rela.init) 25 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 26 *(.rela.fini) 27 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 28 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 29 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 30 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 31 *(.rela.ctors) 32 *(.rela.dtors) 33 *(.rela.got) 34 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 35 *(.rela.ifunc) 36 } 37 .rela.plt : 38 { 39 *(.rela.plt) 40 *(.rela.iplt) 41 } 42 . = ALIGN(CONSTANT (MAXPAGESIZE)); 43 .init : 44 { 45 KEEP (*(SORT_NONE(.init))) 46 } =0x1f2003d5 47 .plt : { *(.plt) *(.iplt) } 48 .text : 49 { 50 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 51 *(.text.exit .text.exit.*) 52 *(.text.startup .text.startup.*) 53 *(.text.hot .text.hot.*) 54 *(SORT(.text.sorted.*)) 55 *(.text .stub .text.* .gnu.linkonce.t.*) 56 /* .gnu.warning sections are handled specially by elf.em. */ 57 *(.gnu.warning) 58 } =0x1f2003d5 59 .fini : 60 { 61 KEEP (*(SORT_NONE(.fini))) 62 } =0x1f2003d5 63 PROVIDE (__etext = .); 64 PROVIDE (_etext = .); 65 PROVIDE (etext = .); 66 . = ALIGN(CONSTANT (MAXPAGESIZE)); 67 /* Adjust the address for the rodata segment. We want to adjust up to 68 the same address within the page on the next page up. */ 69 . = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1))); 70 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 71 .rodata1 : { *(.rodata1) } 72 .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } 73 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } 74 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } 75 .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } 76 /* These sections are generated by the Sun/Oracle C++ compiler. */ 77 .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) } 78 /* Adjust the address for the data segment. We want to adjust up to 79 the same address within the page on the next page up. */ 80 . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)); 81 /* Exception handling */ 82 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } 83 .gnu_extab : ONLY_IF_RW { *(.gnu_extab) } 84 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 85 .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) } 86 /* Thread Local Storage sections */ 87 .tdata : 88 { 89 *(.tdata .tdata.* .gnu.linkonce.td.*) 90 } 91 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 92 .preinit_array : 93 { 94 KEEP (*(.preinit_array)) 95 } 96 .init_array : 97 { 98 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 99 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) 100 } 101 .fini_array : 102 { 103 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 104 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) 105 } 106 .ctors : 107 { 108 /* gcc uses crtbegin.o to find the start of 109 the constructors, so we make sure it is 110 first. Because this is a wildcard, it 111 doesn't matter if the user does not 112 actually link against crtbegin.o; the 113 linker won't look for a file to match a 114 wildcard. The wildcard also means that it 115 doesn't matter which directory crtbegin.o 116 is in. */ 117 KEEP (*crtbegin.o(.ctors)) 118 KEEP (*crtbegin?.o(.ctors)) 119 /* We don't want to include the .ctor section from 120 the crtend.o file until after the sorted ctors. 121 The .ctor section from the crtend file contains the 122 end of ctors marker and it must be last */ 123 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 124 KEEP (*(SORT(.ctors.*))) 125 KEEP (*(.ctors)) 126 } 127 .dtors : 128 { 129 KEEP (*crtbegin.o(.dtors)) 130 KEEP (*crtbegin?.o(.dtors)) 131 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 132 KEEP (*(SORT(.dtors.*))) 133 KEEP (*(.dtors)) 134 } 135 .jcr : { KEEP (*(.jcr)) } 136 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 137 .dynamic : { *(.dynamic) } 138 .got : { *(.got) *(.igot) } 139 .got.plt : { *(.got.plt) *(.igot.plt) } 140 .data : 141 { 142 PROVIDE (__data_start = .); 143 *(.data .data.* .gnu.linkonce.d.*) 144 SORT(CONSTRUCTORS) 145 } 146 .data1 : { *(.data1) } 147 PROVIDE (_edata = .); PROVIDE (edata = .); 148 . = .; 149 PROVIDE (__bss_start = .); 150 PROVIDE (__bss_start__ = .); 151 .bss : 152 { 153 *(.dynbss) 154 *(.bss .bss.* .gnu.linkonce.b.*) 155 *(COMMON) 156 /* Align here to ensure that the .bss section occupies space up to 157 _end. Align after .bss to ensure correct alignment even if the 158 .bss section disappears because there are no input sections. 159 FIXME: Why do we need it? When there is no .bss section, we do not 160 pad the .data section. */ 161 . = ALIGN(. != 0 ? 32 / 8 : 1); 162 } 163 PROVIDE (_bss_end__ = .); PROVIDE (__bss_end__ = .); 164 . = ALIGN(32 / 8); 165 . = SEGMENT_START("ldata-segment", .); 166 . = ALIGN(32 / 8); 167 PROVIDE (__end__ = .); 168 PROVIDE (_end = .); PROVIDE (end = .); 169 .stack 0x80000 : 170 { 171 _stack = .; 172 *(.stack) 173 } 174 /* Stabs debugging sections. */ 175 .stab 0 : { *(.stab) } 176 .stabstr 0 : { *(.stabstr) } 177 .stab.excl 0 : { *(.stab.excl) } 178 .stab.exclstr 0 : { *(.stab.exclstr) } 179 .stab.index 0 : { *(.stab.index) } 180 .stab.indexstr 0 : { *(.stab.indexstr) } 181 .comment 0 : { *(.comment) } 182 .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } 183 /* DWARF debug sections. 184 Symbols in the DWARF debugging sections are relative to the beginning 185 of the section so we begin them at 0. */ 186 /* DWARF 1. */ 187 .debug 0 : { *(.debug) } 188 .line 0 : { *(.line) } 189 /* GNU DWARF 1 extensions. */ 190 .debug_srcinfo 0 : { *(.debug_srcinfo) } 191 .debug_sfnames 0 : { *(.debug_sfnames) } 192 /* DWARF 1.1 and DWARF 2. */ 193 .debug_aranges 0 : { *(.debug_aranges) } 194 .debug_pubnames 0 : { *(.debug_pubnames) } 195 /* DWARF 2. */ 196 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 197 .debug_abbrev 0 : { *(.debug_abbrev) } 198 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } 199 .debug_frame 0 : { *(.debug_frame) } 200 .debug_str 0 : { *(.debug_str) } 201 .debug_loc 0 : { *(.debug_loc) } 202 .debug_macinfo 0 : { *(.debug_macinfo) } 203 /* SGI/MIPS DWARF 2 extensions. */ 204 .debug_weaknames 0 : { *(.debug_weaknames) } 205 .debug_funcnames 0 : { *(.debug_funcnames) } 206 .debug_typenames 0 : { *(.debug_typenames) } 207 .debug_varnames 0 : { *(.debug_varnames) } 208 /* DWARF 3. */ 209 .debug_pubtypes 0 : { *(.debug_pubtypes) } 210 .debug_ranges 0 : { *(.debug_ranges) } 211 /* DWARF 5. */ 212 .debug_addr 0 : { *(.debug_addr) } 213 .debug_line_str 0 : { *(.debug_line_str) } 214 .debug_loclists 0 : { *(.debug_loclists) } 215 .debug_macro 0 : { *(.debug_macro) } 216 .debug_names 0 : { *(.debug_names) } 217 .debug_rnglists 0 : { *(.debug_rnglists) } 218 .debug_str_offsets 0 : { *(.debug_str_offsets) } 219 .debug_sup 0 : { *(.debug_sup) } 220 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 221 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 222 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 223} 224