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/libilp32"); SEARCH_DIR("=/usr/local/libilp32"); SEARCH_DIR("=/libilp32"); SEARCH_DIR("=/usr/libilp32"); SEARCH_DIR("=/aarch64-none-linux-gnu/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/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 : ALIGN(16) { *(.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 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 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 . = DATA_SEGMENT_RELRO_END (12, .); 140 .got.plt : { *(.got.plt) *(.igot.plt) } 141 .data : 142 { 143 PROVIDE (__data_start = .); 144 *(.data .data.* .gnu.linkonce.d.*) 145 SORT(CONSTRUCTORS) 146 } 147 .data1 : { *(.data1) } 148 PROVIDE (_edata = .); PROVIDE (edata = .); 149 . = .; 150 PROVIDE (__bss_start = .); 151 PROVIDE (__bss_start__ = .); 152 .bss : 153 { 154 *(.dynbss) 155 *(.bss .bss.* .gnu.linkonce.b.*) 156 *(COMMON) 157 /* Align here to ensure that the .bss section occupies space up to 158 _end. Align after .bss to ensure correct alignment even if the 159 .bss section disappears because there are no input sections. 160 FIXME: Why do we need it? When there is no .bss section, we do not 161 pad the .data section. */ 162 . = ALIGN(. != 0 ? 32 / 8 : 1); 163 } 164 PROVIDE (_bss_end__ = .); PROVIDE (__bss_end__ = .); 165 . = ALIGN(32 / 8); 166 . = SEGMENT_START("ldata-segment", .); 167 . = ALIGN(32 / 8); 168 PROVIDE (__end__ = .); 169 PROVIDE (_end = .); PROVIDE (end = .); 170 . = DATA_SEGMENT_END (.); 171 /* Stabs debugging sections. */ 172 .stab 0 : { *(.stab) } 173 .stabstr 0 : { *(.stabstr) } 174 .stab.excl 0 : { *(.stab.excl) } 175 .stab.exclstr 0 : { *(.stab.exclstr) } 176 .stab.index 0 : { *(.stab.index) } 177 .stab.indexstr 0 : { *(.stab.indexstr) } 178 .comment 0 : { *(.comment) } 179 .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } 180 /* DWARF debug sections. 181 Symbols in the DWARF debugging sections are relative to the beginning 182 of the section so we begin them at 0. */ 183 /* DWARF 1. */ 184 .debug 0 : { *(.debug) } 185 .line 0 : { *(.line) } 186 /* GNU DWARF 1 extensions. */ 187 .debug_srcinfo 0 : { *(.debug_srcinfo) } 188 .debug_sfnames 0 : { *(.debug_sfnames) } 189 /* DWARF 1.1 and DWARF 2. */ 190 .debug_aranges 0 : { *(.debug_aranges) } 191 .debug_pubnames 0 : { *(.debug_pubnames) } 192 /* DWARF 2. */ 193 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 194 .debug_abbrev 0 : { *(.debug_abbrev) } 195 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } 196 .debug_frame 0 : { *(.debug_frame) } 197 .debug_str 0 : { *(.debug_str) } 198 .debug_loc 0 : { *(.debug_loc) } 199 .debug_macinfo 0 : { *(.debug_macinfo) } 200 /* SGI/MIPS DWARF 2 extensions. */ 201 .debug_weaknames 0 : { *(.debug_weaknames) } 202 .debug_funcnames 0 : { *(.debug_funcnames) } 203 .debug_typenames 0 : { *(.debug_typenames) } 204 .debug_varnames 0 : { *(.debug_varnames) } 205 /* DWARF 3. */ 206 .debug_pubtypes 0 : { *(.debug_pubtypes) } 207 .debug_ranges 0 : { *(.debug_ranges) } 208 /* DWARF 5. */ 209 .debug_addr 0 : { *(.debug_addr) } 210 .debug_line_str 0 : { *(.debug_line_str) } 211 .debug_loclists 0 : { *(.debug_loclists) } 212 .debug_macro 0 : { *(.debug_macro) } 213 .debug_names 0 : { *(.debug_names) } 214 .debug_rnglists 0 : { *(.debug_rnglists) } 215 .debug_str_offsets 0 : { *(.debug_str_offsets) } 216 .debug_sup 0 : { *(.debug_sup) } 217 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 218 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 219 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 220} 221