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