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