1 /* Script for -pie -z combreloc: position independent executable, combine & sort relocs */ 2 OUTPUT_FORMAT("elf64-l1om", "elf64-l1om", 3 "elf64-l1om") 4 OUTPUT_ARCH(l1om) 5 ENTRY(_start) 6 SECTIONS 7 { 8 /* Read-only sections, merged into text segment: */ 9 . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS; 10 .interp : { *(.interp) } 11 .note.gnu.build-id : { *(.note.gnu.build-id) } 12 .hash : { *(.hash) } 13 .gnu.hash : { *(.gnu.hash) } 14 .dynsym : { *(.dynsym) } 15 .dynstr : { *(.dynstr) } 16 .gnu.version : { *(.gnu.version) } 17 .gnu.version_d : { *(.gnu.version_d) } 18 .gnu.version_r : { *(.gnu.version_r) } 19 .rela.dyn : 20 { 21 *(.rela.init) 22 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 23 *(.rela.fini) 24 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 25 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 26 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 27 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 28 *(.rela.ctors) 29 *(.rela.dtors) 30 *(.rela.got) 31 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 32 *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) 33 *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) 34 *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) 35 PROVIDE_HIDDEN (__rel_iplt_start = .); 36 PROVIDE_HIDDEN (__rel_iplt_end = .); 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 (*(.init)) 48 } =0x90909090 49 .plt : { *(.plt) } 50 .iplt : { *(.iplt) } 51 .text : 52 { 53 *(.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 } =0x90909090 61 .fini : 62 { 63 KEEP (*(.fini)) 64 } =0x90909090 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 .gcc_except_table.*) } 73 /* Adjust the address for the data segment. We want to adjust up to 74 the same address within the page on the next page up. */ 75 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 76 /* Exception handling */ 77 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 78 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 79 /* Thread Local Storage sections */ 80 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 81 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 82 .preinit_array : 83 { 84 PROVIDE_HIDDEN (__preinit_array_start = .); 85 KEEP (*(.preinit_array)) 86 PROVIDE_HIDDEN (__preinit_array_end = .); 87 } 88 .init_array : 89 { 90 PROVIDE_HIDDEN (__init_array_start = .); 91 KEEP (*(SORT(.init_array.*))) 92 KEEP (*(.init_array)) 93 PROVIDE_HIDDEN (__init_array_end = .); 94 } 95 .fini_array : 96 { 97 PROVIDE_HIDDEN (__fini_array_start = .); 98 KEEP (*(SORT(.fini_array.*))) 99 KEEP (*(.fini_array)) 100 PROVIDE_HIDDEN (__fini_array_end = .); 101 } 102 .ctors : 103 { 104 /* gcc uses crtbegin.o to find the start of 105 the constructors, so we make sure it is 106 first. Because this is a wildcard, it 107 doesn't matter if the user does not 108 actually link against crtbegin.o; the 109 linker won't look for a file to match a 110 wildcard. The wildcard also means that it 111 doesn't matter which directory crtbegin.o 112 is in. */ 113 KEEP (*crtbegin.o(.ctors)) 114 KEEP (*crtbegin?.o(.ctors)) 115 /* We don't want to include the .ctor section from 116 the crtend.o file until after the sorted ctors. 117 The .ctor section from the crtend file contains the 118 end of ctors marker and it must be last */ 119 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 120 KEEP (*(SORT(.ctors.*))) 121 KEEP (*(.ctors)) 122 } 123 .dtors : 124 { 125 KEEP (*crtbegin.o(.dtors)) 126 KEEP (*crtbegin?.o(.dtors)) 127 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 128 KEEP (*(SORT(.dtors.*))) 129 KEEP (*(.dtors)) 130 } 131 .jcr : { KEEP (*(.jcr)) } 132 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } 133 .dynamic : { *(.dynamic) } 134 .got : { *(.got) *(.igot) } 135 . = DATA_SEGMENT_RELRO_END (24, .); 136 .got.plt : { *(.got.plt) *(.igot.plt) } 137 .data : 138 { 139 *(.data .data.* .gnu.linkonce.d.*) 140 SORT(CONSTRUCTORS) 141 } 142 .data1 : { *(.data1) } 143 _edata = .; PROVIDE (edata = .); 144 __bss_start = .; 145 .bss : 146 { 147 *(.dynbss) 148 *(.bss .bss.* .gnu.linkonce.b.*) 149 *(COMMON) 150 /* Align here to ensure that the .bss section occupies space up to 151 _end. Align after .bss to ensure correct alignment even if the 152 .bss section disappears because there are no input sections. 153 FIXME: Why do we need it? When there is no .bss section, we don't 154 pad the .data section. */ 155 . = ALIGN(. != 0 ? 64 / 8 : 1); 156 } 157 .lbss : 158 { 159 *(.dynlbss) 160 *(.lbss .lbss.* .gnu.linkonce.lb.*) 161 *(LARGE_COMMON) 162 } 163 . = ALIGN(64 / 8); 164 .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : 165 { 166 *(.lrodata .lrodata.* .gnu.linkonce.lr.*) 167 } 168 .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : 169 { 170 *(.ldata .ldata.* .gnu.linkonce.l.*) 171 . = ALIGN(. != 0 ? 64 / 8 : 1); 172 } 173 . = ALIGN(64 / 8); 174 _end = .; PROVIDE (end = .); 175 . = DATA_SEGMENT_END (.); 176 /* Stabs debugging sections. */ 177 .stab 0 : { *(.stab) } 178 .stabstr 0 : { *(.stabstr) } 179 .stab.excl 0 : { *(.stab.excl) } 180 .stab.exclstr 0 : { *(.stab.exclstr) } 181 .stab.index 0 : { *(.stab.index) } 182 .stab.indexstr 0 : { *(.stab.indexstr) } 183 .comment 0 : { *(.comment) } 184 /* DWARF debug sections. 185 Symbols in the DWARF debugging sections are relative to the beginning 186 of the section so we begin them at 0. */ 187 /* DWARF 1 */ 188 .debug 0 : { *(.debug) } 189 .line 0 : { *(.line) } 190 /* GNU DWARF 1 extensions */ 191 .debug_srcinfo 0 : { *(.debug_srcinfo .zdebug_srcinfo) } 192 .debug_sfnames 0 : { *(.debug_sfnames .zdebug_sfnames) } 193 /* DWARF 1.1 and DWARF 2 */ 194 .debug_aranges 0 : { *(.debug_aranges .zdebug_aranges) } 195 .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) } 196 /* DWARF 2 */ 197 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info) } 198 .debug_abbrev 0 : { *(.debug_abbrev .zdebug_abbrev) } 199 .debug_line 0 : { *(.debug_line .zdebug_line) } 200 .debug_frame 0 : { *(.debug_frame .zdebug_frame) } 201 .debug_str 0 : { *(.debug_str .zdebug_str) } 202 .debug_loc 0 : { *(.debug_loc .zdebug_loc) } 203 .debug_macinfo 0 : { *(.debug_macinfo .zdebug_macinfo) } 204 /* SGI/MIPS DWARF 2 extensions */ 205 .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames) } 206 .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames) } 207 .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames) } 208 .debug_varnames 0 : { *(.debug_varnames .zdebug_varnames) } 209 /* DWARF 3 */ 210 .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) } 211 .debug_ranges 0 : { *(.debug_ranges .zdebug_ranges) } 212 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 213 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 214 } 215