1*433d6423SLionel Sambuc/* Script for -z combreloc: combine and sort reloc sections */ 2*433d6423SLionel SambucOUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", 3*433d6423SLionel Sambuc "elf32-littlearm") 4*433d6423SLionel SambucOUTPUT_ARCH(arm) 5*433d6423SLionel SambucENTRY(_start) 6*433d6423SLionel SambucSEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); 7*433d6423SLionel SambucSECTIONS 8*433d6423SLionel Sambuc{ 9*433d6423SLionel Sambuc /* Read-only sections, merged into text segment: */ 10*433d6423SLionel Sambuc PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x8000)); . = SEGMENT_START("text-segment", 0x8000); 11*433d6423SLionel Sambuc .interp : { *(.interp) } 12*433d6423SLionel Sambuc .note.gnu.build-id : { *(.note.gnu.build-id) } 13*433d6423SLionel Sambuc .hash : { *(.hash) } 14*433d6423SLionel Sambuc .gnu.hash : { *(.gnu.hash) } 15*433d6423SLionel Sambuc .dynsym : { *(.dynsym) } 16*433d6423SLionel Sambuc .dynstr : { *(.dynstr) } 17*433d6423SLionel Sambuc .gnu.version : { *(.gnu.version) } 18*433d6423SLionel Sambuc .gnu.version_d : { *(.gnu.version_d) } 19*433d6423SLionel Sambuc .gnu.version_r : { *(.gnu.version_r) } 20*433d6423SLionel Sambuc .rel.dyn : 21*433d6423SLionel Sambuc { 22*433d6423SLionel Sambuc *(.rel.init) 23*433d6423SLionel Sambuc *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) 24*433d6423SLionel Sambuc *(.rel.fini) 25*433d6423SLionel Sambuc *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 26*433d6423SLionel Sambuc *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) 27*433d6423SLionel Sambuc *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) 28*433d6423SLionel Sambuc *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) 29*433d6423SLionel Sambuc *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) 30*433d6423SLionel Sambuc *(.rel.ctors) 31*433d6423SLionel Sambuc *(.rel.dtors) 32*433d6423SLionel Sambuc *(.rel.got) 33*433d6423SLionel Sambuc *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) 34*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rel_iplt_start = .); 35*433d6423SLionel Sambuc *(.rel.iplt) 36*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rel_iplt_end = .); 37*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rela_iplt_start = .); 38*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rela_iplt_end = .); 39*433d6423SLionel Sambuc } 40*433d6423SLionel Sambuc .rela.dyn : 41*433d6423SLionel Sambuc { 42*433d6423SLionel Sambuc *(.rela.init) 43*433d6423SLionel Sambuc *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 44*433d6423SLionel Sambuc *(.rela.fini) 45*433d6423SLionel Sambuc *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) 46*433d6423SLionel Sambuc *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 47*433d6423SLionel Sambuc *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) 48*433d6423SLionel Sambuc *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) 49*433d6423SLionel Sambuc *(.rela.ctors) 50*433d6423SLionel Sambuc *(.rela.dtors) 51*433d6423SLionel Sambuc *(.rela.got) 52*433d6423SLionel Sambuc *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) 53*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rel_iplt_start = .); 54*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rel_iplt_end = .); 55*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rela_iplt_start = .); 56*433d6423SLionel Sambuc *(.rela.iplt) 57*433d6423SLionel Sambuc PROVIDE_HIDDEN (__rela_iplt_end = .); 58*433d6423SLionel Sambuc } 59*433d6423SLionel Sambuc .rel.plt : 60*433d6423SLionel Sambuc { 61*433d6423SLionel Sambuc *(.rel.plt) 62*433d6423SLionel Sambuc } 63*433d6423SLionel Sambuc .rela.plt : 64*433d6423SLionel Sambuc { 65*433d6423SLionel Sambuc *(.rela.plt) 66*433d6423SLionel Sambuc } 67*433d6423SLionel Sambuc .init : 68*433d6423SLionel Sambuc { 69*433d6423SLionel Sambuc KEEP (*(.init)) 70*433d6423SLionel Sambuc } =0 71*433d6423SLionel Sambuc .plt : { *(.plt) } 72*433d6423SLionel Sambuc .iplt : { *(.iplt) } 73*433d6423SLionel Sambuc .text : 74*433d6423SLionel Sambuc { 75*433d6423SLionel Sambuc *(.text.unlikely .text.*_unlikely) 76*433d6423SLionel Sambuc *(.text.exit .text.exit.*) 77*433d6423SLionel Sambuc *(.text.startup .text.startup.*) 78*433d6423SLionel Sambuc *(.text.hot .text.hot.*) 79*433d6423SLionel Sambuc *(.text .stub .text.* .gnu.linkonce.t.*) 80*433d6423SLionel Sambuc /* .gnu.warning sections are handled specially by elf32.em. */ 81*433d6423SLionel Sambuc *(.gnu.warning) 82*433d6423SLionel Sambuc *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) 83*433d6423SLionel Sambuc } =0 84*433d6423SLionel Sambuc .fini : 85*433d6423SLionel Sambuc { 86*433d6423SLionel Sambuc KEEP (*(.fini)) 87*433d6423SLionel Sambuc } =0 88*433d6423SLionel Sambuc PROVIDE (__etext = .); 89*433d6423SLionel Sambuc PROVIDE (_etext = .); 90*433d6423SLionel Sambuc PROVIDE (etext = .); 91*433d6423SLionel Sambuc .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 92*433d6423SLionel Sambuc .rodata1 : { *(.rodata1) } 93*433d6423SLionel Sambuc .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } 94*433d6423SLionel Sambuc PROVIDE_HIDDEN (__exidx_start = .); 95*433d6423SLionel Sambuc .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } 96*433d6423SLionel Sambuc PROVIDE_HIDDEN (__exidx_end = .); 97*433d6423SLionel Sambuc .eh_frame_hdr : { *(.eh_frame_hdr) } 98*433d6423SLionel Sambuc .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 99*433d6423SLionel Sambuc .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 100*433d6423SLionel Sambuc .gcc_except_table.*) } 101*433d6423SLionel Sambuc /* These sections are generated by the Sun/Oracle C++ compiler. */ 102*433d6423SLionel Sambuc .exception_ranges : ONLY_IF_RO { *(.exception_ranges 103*433d6423SLionel Sambuc .exception_ranges*) } 104*433d6423SLionel Sambuc /* Adjust the address for the data segment. We want to adjust up to 105*433d6423SLionel Sambuc the same address within the page on the next page up. */ 106*433d6423SLionel Sambuc/* XXX: align on page boundary */ 107*433d6423SLionel Sambuc/* . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));*/ 108*433d6423SLionel Sambuc . = ALIGN(4096); 109*433d6423SLionel Sambuc /* Exception handling */ 110*433d6423SLionel Sambuc .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 111*433d6423SLionel Sambuc .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 112*433d6423SLionel Sambuc .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 113*433d6423SLionel Sambuc /* Thread Local Storage sections */ 114*433d6423SLionel Sambuc .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 115*433d6423SLionel Sambuc .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 116*433d6423SLionel Sambuc .preinit_array : 117*433d6423SLionel Sambuc { 118*433d6423SLionel Sambuc PROVIDE_HIDDEN (__preinit_array_start = .); 119*433d6423SLionel Sambuc KEEP (*(.preinit_array)) 120*433d6423SLionel Sambuc PROVIDE_HIDDEN (__preinit_array_end = .); 121*433d6423SLionel Sambuc } 122*433d6423SLionel Sambuc .init_array : 123*433d6423SLionel Sambuc { 124*433d6423SLionel Sambuc PROVIDE_HIDDEN (__init_array_start = .); 125*433d6423SLionel Sambuc KEEP (*(SORT(.init_array.*))) 126*433d6423SLionel Sambuc KEEP (*(.init_array)) 127*433d6423SLionel Sambuc PROVIDE_HIDDEN (__init_array_end = .); 128*433d6423SLionel Sambuc } 129*433d6423SLionel Sambuc .fini_array : 130*433d6423SLionel Sambuc { 131*433d6423SLionel Sambuc PROVIDE_HIDDEN (__fini_array_start = .); 132*433d6423SLionel Sambuc KEEP (*(SORT(.fini_array.*))) 133*433d6423SLionel Sambuc KEEP (*(.fini_array)) 134*433d6423SLionel Sambuc PROVIDE_HIDDEN (__fini_array_end = .); 135*433d6423SLionel Sambuc } 136*433d6423SLionel Sambuc .ctors : 137*433d6423SLionel Sambuc { 138*433d6423SLionel Sambuc /* gcc uses crtbegin.o to find the start of 139*433d6423SLionel Sambuc the constructors, so we make sure it is 140*433d6423SLionel Sambuc first. Because this is a wildcard, it 141*433d6423SLionel Sambuc doesn't matter if the user does not 142*433d6423SLionel Sambuc actually link against crtbegin.o; the 143*433d6423SLionel Sambuc linker won't look for a file to match a 144*433d6423SLionel Sambuc wildcard. The wildcard also means that it 145*433d6423SLionel Sambuc doesn't matter which directory crtbegin.o 146*433d6423SLionel Sambuc is in. */ 147*433d6423SLionel Sambuc KEEP (*crtbegin.o(.ctors)) 148*433d6423SLionel Sambuc KEEP (*crtbegin?.o(.ctors)) 149*433d6423SLionel Sambuc /* We don't want to include the .ctor section from 150*433d6423SLionel Sambuc the crtend.o file until after the sorted ctors. 151*433d6423SLionel Sambuc The .ctor section from the crtend file contains the 152*433d6423SLionel Sambuc end of ctors marker and it must be last */ 153*433d6423SLionel Sambuc KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 154*433d6423SLionel Sambuc KEEP (*(SORT(.ctors.*))) 155*433d6423SLionel Sambuc KEEP (*(.ctors)) 156*433d6423SLionel Sambuc } 157*433d6423SLionel Sambuc .dtors : 158*433d6423SLionel Sambuc { 159*433d6423SLionel Sambuc KEEP (*crtbegin.o(.dtors)) 160*433d6423SLionel Sambuc KEEP (*crtbegin?.o(.dtors)) 161*433d6423SLionel Sambuc KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 162*433d6423SLionel Sambuc KEEP (*(SORT(.dtors.*))) 163*433d6423SLionel Sambuc KEEP (*(.dtors)) 164*433d6423SLionel Sambuc } 165*433d6423SLionel Sambuc/* XXX: no jcr, got, etc. 166*433d6423SLionel Sambuc 167*433d6423SLionel Sambuc .jcr : { KEEP (*(.jcr)) } 168*433d6423SLionel Sambuc .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } 169*433d6423SLionel Sambuc .dynamic : { *(.dynamic) } 170*433d6423SLionel Sambuc .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) } 171*433d6423SLionel Sambuc*/ 172*433d6423SLionel Sambuc .data : 173*433d6423SLionel Sambuc { 174*433d6423SLionel Sambuc __data_start = . ; 175*433d6423SLionel Sambuc /* XXX: put pagetable data at beginning */ 176*433d6423SLionel Sambuc pagetable.o(.data) 177*433d6423SLionel Sambuc *(.data .data.* .gnu.linkonce.d.*) 178*433d6423SLionel Sambuc SORT(CONSTRUCTORS) 179*433d6423SLionel Sambuc /* XXX: 16KB align */ 180*433d6423SLionel Sambuc . = ALIGN(16384); 181*433d6423SLionel Sambuc } 182*433d6423SLionel Sambuc .data1 : { *(.data1) } 183*433d6423SLionel Sambuc _edata = .; PROVIDE (edata = .); 184*433d6423SLionel Sambuc __bss_start = .; 185*433d6423SLionel Sambuc __bss_start__ = .; 186*433d6423SLionel Sambuc .bss : 187*433d6423SLionel Sambuc { 188*433d6423SLionel Sambuc /* XXX: put pagetable bss at beginning */ 189*433d6423SLionel Sambuc pagetable.o(.bss) 190*433d6423SLionel Sambuc *(.dynbss) 191*433d6423SLionel Sambuc *(.bss .bss.* .gnu.linkonce.b.*) 192*433d6423SLionel Sambuc *(COMMON) 193*433d6423SLionel Sambuc /* Align here to ensure that the .bss section occupies space up to 194*433d6423SLionel Sambuc _end. Align after .bss to ensure correct alignment even if the 195*433d6423SLionel Sambuc .bss section disappears because there are no input sections. 196*433d6423SLionel Sambuc FIXME: Why do we need it? When there is no .bss section, we don't 197*433d6423SLionel Sambuc pad the .data section. */ 198*433d6423SLionel Sambuc . = ALIGN(. != 0 ? 32 / 8 : 1); 199*433d6423SLionel Sambuc } 200*433d6423SLionel Sambuc _bss_end__ = . ; __bss_end__ = . ; 201*433d6423SLionel Sambuc . = ALIGN(32 / 8); 202*433d6423SLionel Sambuc . = ALIGN(32 / 8); 203*433d6423SLionel Sambuc __end__ = . ; 204*433d6423SLionel Sambuc _end = .; PROVIDE (end = .); 205*433d6423SLionel Sambuc /* Stabs debugging sections. */ 206*433d6423SLionel Sambuc .stab 0 : { *(.stab) } 207*433d6423SLionel Sambuc .stabstr 0 : { *(.stabstr) } 208*433d6423SLionel Sambuc .stab.excl 0 : { *(.stab.excl) } 209*433d6423SLionel Sambuc .stab.exclstr 0 : { *(.stab.exclstr) } 210*433d6423SLionel Sambuc .stab.index 0 : { *(.stab.index) } 211*433d6423SLionel Sambuc .stab.indexstr 0 : { *(.stab.indexstr) } 212*433d6423SLionel Sambuc .comment 0 : { *(.comment) } 213*433d6423SLionel Sambuc /* DWARF debug sections. 214*433d6423SLionel Sambuc Symbols in the DWARF debugging sections are relative to the beginning 215*433d6423SLionel Sambuc of the section so we begin them at 0. */ 216*433d6423SLionel Sambuc /* DWARF 1 */ 217*433d6423SLionel Sambuc .debug 0 : { *(.debug) } 218*433d6423SLionel Sambuc .line 0 : { *(.line) } 219*433d6423SLionel Sambuc /* GNU DWARF 1 extensions */ 220*433d6423SLionel Sambuc .debug_srcinfo 0 : { *(.debug_srcinfo) } 221*433d6423SLionel Sambuc .debug_sfnames 0 : { *(.debug_sfnames) } 222*433d6423SLionel Sambuc /* DWARF 1.1 and DWARF 2 */ 223*433d6423SLionel Sambuc .debug_aranges 0 : { *(.debug_aranges) } 224*433d6423SLionel Sambuc .debug_pubnames 0 : { *(.debug_pubnames) } 225*433d6423SLionel Sambuc /* DWARF 2 */ 226*433d6423SLionel Sambuc .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 227*433d6423SLionel Sambuc .debug_abbrev 0 : { *(.debug_abbrev) } 228*433d6423SLionel Sambuc .debug_line 0 : { *(.debug_line) } 229*433d6423SLionel Sambuc .debug_frame 0 : { *(.debug_frame) } 230*433d6423SLionel Sambuc .debug_str 0 : { *(.debug_str) } 231*433d6423SLionel Sambuc .debug_loc 0 : { *(.debug_loc) } 232*433d6423SLionel Sambuc .debug_macinfo 0 : { *(.debug_macinfo) } 233*433d6423SLionel Sambuc /* SGI/MIPS DWARF 2 extensions */ 234*433d6423SLionel Sambuc .debug_weaknames 0 : { *(.debug_weaknames) } 235*433d6423SLionel Sambuc .debug_funcnames 0 : { *(.debug_funcnames) } 236*433d6423SLionel Sambuc .debug_typenames 0 : { *(.debug_typenames) } 237*433d6423SLionel Sambuc .debug_varnames 0 : { *(.debug_varnames) } 238*433d6423SLionel Sambuc /* DWARF 3 */ 239*433d6423SLionel Sambuc .debug_pubtypes 0 : { *(.debug_pubtypes) } 240*433d6423SLionel Sambuc .debug_ranges 0 : { *(.debug_ranges) } 241*433d6423SLionel Sambuc .stack 0x80000 : 242*433d6423SLionel Sambuc { 243*433d6423SLionel Sambuc _stack = .; 244*433d6423SLionel Sambuc *(.stack) 245*433d6423SLionel Sambuc } 246*433d6423SLionel Sambuc .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) } 247*433d6423SLionel Sambuc .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 248*433d6423SLionel Sambuc /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 249*433d6423SLionel Sambuc} 250