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