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