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