1/* 2 * Linker script for ELF dynamic loaded modules. 3 */ 4 5/* Script for --shared -z combreloc: shared library, combine & sort relocs */ 6OUTPUT_FORMAT("elf32-i386", "elf32-i386", 7 "elf32-i386") 8OUTPUT_ARCH(i386) 9SECTIONS 10{ 11 /* Read-only sections, merged into text segment: */ 12 . = 0 + SIZEOF_HEADERS; 13 .note.gnu.build-id : { *(.note.gnu.build-id) } 14 .hash : { *(.hash) } 15 .gnu.hash : { *(.gnu.hash) } 16 .dynsym : { *(.dynsym) } 17 .dynstr : { *(.dynstr) } 18 .gnu.version : { *(.gnu.version) } 19 .gnu.version_d : { *(.gnu.version_d) } 20 .gnu.version_r : { *(.gnu.version_r) } 21 .rel.dyn : 22 { 23 *(.rel.init) 24 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) 25 *(.rel.fini) 26 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 27 *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) 28 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) 29 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) 30 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) 31 *(.rel.ctors) 32 *(.rel.dtors) 33 *(.rel.got) 34 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) 35 } 36 .rela.dyn : 37 { 38 *(.rela.init) 39 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 40 *(.rela.fini) 41 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 42 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 43 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 44 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 45 *(.rela.ctors) 46 *(.rela.dtors) 47 *(.rela.got) 48 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 49 } 50 .rel.plt : { *(.rel.plt) } 51 .rela.plt : { *(.rela.plt) } 52 .init : 53 { 54 KEEP (*(.init)) 55 } =0x90909090 56 .plt : { *(.plt) } 57 .text : 58 { 59 *(.text .stub .text.* .gnu.linkonce.t.*) 60 KEEP (*(.text.*personality*)) 61 /* .gnu.warning sections are handled specially by elf32.em. */ 62 *(.gnu.warning) 63 } =0x90909090 64 .fini : 65 { 66 KEEP (*(.fini)) 67 } =0x90909090 68 PROVIDE (__etext = .); 69 PROVIDE (_etext = .); 70 PROVIDE (etext = .); 71 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 72 .rodata1 : { *(.rodata1) } 73 . = ALIGN(4); 74 .preinit_array : 75 { 76 KEEP (*(.preinit_array)) 77 } 78 .ctors : 79 { 80 __ctors_start = .; 81 KEEP (*(SORT(.ctors.*))) 82 KEEP (*(.ctors)) 83 KEEP (*(.ctors_modinit)) 84 KEEP (*(.ctors_modmain)) 85 KEEP (*(SORT(.init_array.*))) 86 KEEP (*(.init_array)) 87 __ctors_end = .; 88 } 89 90 .dtors : 91 { 92 __dtors_start = .; 93 KEEP (*(SORT(.dtors.*))) 94 KEEP (*(.dtors)) 95 KEEP (*(.dtors_modexit)) 96 KEEP (*(.fini_array)) 97 KEEP (*(SORT(.fini_array.*))) 98 __dtors_end = .; 99 } 100 101 .jcr : { KEEP (*(.jcr)) } 102 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } 103 .dynamic : { *(.dynamic) } 104 .got : { *(.got) } 105 /*. = DATA_SEGMENT_RELRO_END (12, .); -> This gives a "invalid assignment to location counter" error */ 106 .got.plt : { *(.got.plt) } 107 .data : 108 { 109 *(.data .data.* .gnu.linkonce.d.*) 110 KEEP (*(.gnu.linkonce.d.*personality*)) 111 SORT(CONSTRUCTORS) 112 } 113 .data1 : { *(.data1) } 114 PROVIDE (edata = .); 115 PROVIDE (_edata = .); 116 .bss : 117 { 118 *(.dynbss) 119 *(.bss .bss.* .gnu.linkonce.b.*) 120 *(COMMON) 121 /* Align here to ensure that the .bss section occupies space up to 122 _end. Align after .bss to ensure correct alignment even if the 123 .bss section disappears because there are no input sections. 124 FIXME: Why do we need it? When there is no .bss section, we don't 125 pad the .data section. */ 126 . = ALIGN(. != 0 ? 32 / 8 : 1); 127 } 128 . = ALIGN(32 / 8); 129 . = ALIGN(32 / 8); 130 PROVIDE (_end = .); 131 PROVIDE (end = .); 132 /*. = DATA_SEGMENT_END (.); -> This gives a "invalid assignment to location counter" error */ 133 /* Stabs debugging sections. */ 134 .stab 0 : { *(.stab) } 135 .stabstr 0 : { *(.stabstr) } 136 .stab.excl 0 : { *(.stab.excl) } 137 .stab.exclstr 0 : { *(.stab.exclstr) } 138 .stab.index 0 : { *(.stab.index) } 139 .stab.indexstr 0 : { *(.stab.indexstr) } 140 .comment 0 : { *(.comment) } 141 /* DWARF debug sections. 142 Symbols in the DWARF debugging sections are relative to the beginning 143 of the section so we begin them at 0. */ 144 /* DWARF 1 */ 145 .debug 0 : { *(.debug) } 146 .line 0 : { *(.line) } 147 /* GNU DWARF 1 extensions */ 148 .debug_srcinfo 0 : { *(.debug_srcinfo) } 149 .debug_sfnames 0 : { *(.debug_sfnames) } 150 /* DWARF 1.1 and DWARF 2 */ 151 .debug_aranges 0 : { *(.debug_aranges) } 152 .debug_pubnames 0 : { *(.debug_pubnames) } 153 /* DWARF 2 */ 154 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 155 .debug_abbrev 0 : { *(.debug_abbrev) } 156 .debug_line 0 : { *(.debug_line) } 157 .debug_frame 0 : { *(.debug_frame) } 158 .debug_str 0 : { *(.debug_str) } 159 .debug_loc 0 : { *(.debug_loc) } 160 .debug_macinfo 0 : { *(.debug_macinfo) } 161 /* SGI/MIPS DWARF 2 extensions */ 162 .debug_weaknames 0 : { *(.debug_weaknames) } 163 .debug_funcnames 0 : { *(.debug_funcnames) } 164 .debug_typenames 0 : { *(.debug_typenames) } 165 .debug_varnames 0 : { *(.debug_varnames) } 166 /* DWARF 3 */ 167 .debug_pubtypes 0 : { *(.debug_pubtypes) } 168 .debug_ranges 0 : { *(.debug_ranges) } 169 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 170 /DISCARD/ : { *(.eh_frame) } 171} 172