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("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); 7 SECTIONS 8 { 9 /* Read-only sections, merged into text segment: */ 10 . = 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 .rela.init : { *(.rela.init) } 21 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 22 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 23 .rel.fini : { *(.rel.fini) } 24 .rela.fini : { *(.rela.fini) } 25 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 26 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 27 .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } 28 .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } 29 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 30 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 31 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 32 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 33 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 34 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 35 .rel.ctors : { *(.rel.ctors) } 36 .rela.ctors : { *(.rela.ctors) } 37 .rel.dtors : { *(.rel.dtors) } 38 .rela.dtors : { *(.rela.dtors) } 39 .rel.got : { *(.rel.got) } 40 .rela.got : { *(.rela.got) } 41 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 42 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 43 .rel.plt : { *(.rel.plt) } 44 .rela.plt : { *(.rela.plt) } 45 .init : 46 { 47 KEEP (*(.init)) 48 } =0x90909090 49 .plt : { *(.plt) } 50 .text : 51 { 52 *(.text .stub .text.* .gnu.linkonce.t.*) 53 /* .gnu.warning sections are handled specially by elf32.em. */ 54 *(.gnu.warning) 55 } =0x90909090 56 .fini : 57 { 58 KEEP (*(.fini)) 59 } =0x90909090 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 .gcc_except_table.*) } 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 /* Thread Local Storage sections */ 75 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 76 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 77 .preinit_array : 78 { 79 KEEP (*(.preinit_array)) 80 } 81 .init_array : 82 { 83 KEEP (*(SORT(.init_array.*))) 84 KEEP (*(.init_array)) 85 } 86 .fini_array : 87 { 88 KEEP (*(.fini_array)) 89 KEEP (*(SORT(.fini_array.*))) 90 } 91 .ctors : 92 { 93 /* gcc uses crtbegin.o to find the start of 94 the constructors, so we make sure it is 95 first. Because this is a wildcard, it 96 doesn't matter if the user does not 97 actually link against crtbegin.o; the 98 linker won't look for a file to match a 99 wildcard. The wildcard also means that it 100 doesn't matter which directory crtbegin.o 101 is in. */ 102 KEEP (*crtbegin.o(.ctors)) 103 KEEP (*crtbegin?.o(.ctors)) 104 /* We don't want to include the .ctor section from 105 the crtend.o file until after the sorted ctors. 106 The .ctor section from the crtend file contains the 107 end of ctors marker and it must be last */ 108 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 109 KEEP (*(SORT(.ctors.*))) 110 KEEP (*(.ctors)) 111 } 112 .dtors : 113 { 114 KEEP (*crtbegin.o(.dtors)) 115 KEEP (*crtbegin?.o(.dtors)) 116 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 117 KEEP (*(SORT(.dtors.*))) 118 KEEP (*(.dtors)) 119 } 120 .jcr : { KEEP (*(.jcr)) } 121 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } 122 .dynamic : { *(.dynamic) } 123 .got : { *(.got) } 124 . = DATA_SEGMENT_RELRO_END (12, .); 125 .got.plt : { *(.got.plt) } 126 .data : 127 { 128 *(.data .data.* .gnu.linkonce.d.*) 129 SORT(CONSTRUCTORS) 130 } 131 .data1 : { *(.data1) } 132 _edata = .; PROVIDE (edata = .); 133 __bss_start = .; 134 .bss : 135 { 136 *(.dynbss) 137 *(.bss .bss.* .gnu.linkonce.b.*) 138 *(COMMON) 139 /* Align here to ensure that the .bss section occupies space up to 140 _end. Align after .bss to ensure correct alignment even if the 141 .bss section disappears because there are no input sections. 142 FIXME: Why do we need it? When there is no .bss section, we don't 143 pad the .data section. */ 144 . = ALIGN(. != 0 ? 32 / 8 : 1); 145 } 146 . = ALIGN(32 / 8); 147 . = ALIGN(32 / 8); 148 _end = .; PROVIDE (end = .); 149 . = DATA_SEGMENT_END (.); 150 /* Stabs debugging sections. */ 151 .stab 0 : { *(.stab) } 152 .stabstr 0 : { *(.stabstr) } 153 .stab.excl 0 : { *(.stab.excl) } 154 .stab.exclstr 0 : { *(.stab.exclstr) } 155 .stab.index 0 : { *(.stab.index) } 156 .stab.indexstr 0 : { *(.stab.indexstr) } 157 .comment 0 : { *(.comment) } 158 /* DWARF debug sections. 159 Symbols in the DWARF debugging sections are relative to the beginning 160 of the section so we begin them at 0. */ 161 /* DWARF 1 */ 162 .debug 0 : { *(.debug) } 163 .line 0 : { *(.line) } 164 /* GNU DWARF 1 extensions */ 165 .debug_srcinfo 0 : { *(.debug_srcinfo) } 166 .debug_sfnames 0 : { *(.debug_sfnames) } 167 /* DWARF 1.1 and DWARF 2 */ 168 .debug_aranges 0 : { *(.debug_aranges) } 169 .debug_pubnames 0 : { *(.debug_pubnames) } 170 /* DWARF 2 */ 171 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 172 .debug_abbrev 0 : { *(.debug_abbrev) } 173 .debug_line 0 : { *(.debug_line) } 174 .debug_frame 0 : { *(.debug_frame) } 175 .debug_str 0 : { *(.debug_str) } 176 .debug_loc 0 : { *(.debug_loc) } 177 .debug_macinfo 0 : { *(.debug_macinfo) } 178 /* SGI/MIPS DWARF 2 extensions */ 179 .debug_weaknames 0 : { *(.debug_weaknames) } 180 .debug_funcnames 0 : { *(.debug_funcnames) } 181 .debug_typenames 0 : { *(.debug_typenames) } 182 .debug_varnames 0 : { *(.debug_varnames) } 183 /* DWARF 3 */ 184 .debug_pubtypes 0 : { *(.debug_pubtypes) } 185 .debug_ranges 0 : { *(.debug_ranges) } 186 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 187 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } 188 } 189