1*3d8817e4Smiod# 2*3d8817e4Smiod# Unusual variables checked by this code: 3*3d8817e4Smiod# NOP - four byte opcode for no-op (defaults to 0) 4*3d8817e4Smiod# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start 5*3d8817e4Smiod# OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ... 6*3d8817e4Smiod# (e.g., .PARISC.milli) 7*3d8817e4Smiod# OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ... 8*3d8817e4Smiod# (e.g., .PARISC.global) 9*3d8817e4Smiod# OTHER_SECTIONS - at the end 10*3d8817e4Smiod# EXECUTABLE_SYMBOLS - symbols that must be defined for an 11*3d8817e4Smiod# executable (e.g., _DYNAMIC_LINK) 12*3d8817e4Smiod# TEXT_START_SYMBOLS - symbols that appear at the start of the 13*3d8817e4Smiod# .text section. 14*3d8817e4Smiod# DATA_START_SYMBOLS - symbols that appear at the start of the 15*3d8817e4Smiod# .data section. 16*3d8817e4Smiod# OTHER_BSS_SYMBOLS - symbols that appear at the start of the 17*3d8817e4Smiod# .bss section besides __bss_start. 18*3d8817e4Smiod# DATA_PLT - .plt should be in data segment, not text segment. 19*3d8817e4Smiod# 20*3d8817e4Smiod# When adding sections, do note that the names of some sections are used 21*3d8817e4Smiod# when specifying the start address of the next. 22*3d8817e4Smiod# 23*3d8817e4Smiodtest -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} 24*3d8817e4Smiodtest -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 25*3d8817e4Smiodtest "$LD_FLAG" = "N" && DATA_ADDR=. 26*3d8817e4SmiodINTERP=".interp ${RELOCATING-0} : { *(.interp) }" 27*3d8817e4SmiodPLT=".plt ${RELOCATING-0} : { *(.plt) }" 28*3d8817e4Smiodcat <<EOF 29*3d8817e4SmiodOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", 30*3d8817e4Smiod "${LITTLE_OUTPUT_FORMAT}") 31*3d8817e4SmiodOUTPUT_ARCH(${ARCH}) 32*3d8817e4Smiod 33*3d8817e4Smiod${RELOCATING+${LIB_SEARCH_DIRS}} 34*3d8817e4Smiod${RELOCATING+/* Do we need any of these for elf? 35*3d8817e4Smiod __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} 36*3d8817e4Smiod${RELOCATING+${EXECUTABLE_SYMBOLS}} 37*3d8817e4Smiod${RELOCATING- /* For some reason, the Solaris linker makes bad executables 38*3d8817e4Smiod if gld -r is used and the intermediate file has sections starting 39*3d8817e4Smiod at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld 40*3d8817e4Smiod bug. But for now assigning the zero vmas works. */} 41*3d8817e4SmiodSECTIONS 42*3d8817e4Smiod{ 43*3d8817e4Smiod /* Read-only sections, merged into text segment: */ 44*3d8817e4Smiod ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} 45*3d8817e4Smiod ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} 46*3d8817e4Smiod ${CREATE_SHLIB-${INTERP}} 47*3d8817e4Smiod .hash ${RELOCATING-0} : { *(.hash) } 48*3d8817e4Smiod .dynsym ${RELOCATING-0} : { *(.dynsym) } 49*3d8817e4Smiod .dynstr ${RELOCATING-0} : { *(.dynstr) } 50*3d8817e4Smiod .rel.text ${RELOCATING-0} : { *(.rel.text) } 51*3d8817e4Smiod .rela.text ${RELOCATING-0} : { *(.rela.text) } 52*3d8817e4Smiod .rel.data ${RELOCATING-0} : { *(.rel.data) } 53*3d8817e4Smiod .rela.data ${RELOCATING-0} : { *(.rela.data) } 54*3d8817e4Smiod .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } 55*3d8817e4Smiod .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } 56*3d8817e4Smiod .rel.got ${RELOCATING-0} : { *(.rel.got) } 57*3d8817e4Smiod .rela.got ${RELOCATING-0} : { *(.rela.got) } 58*3d8817e4Smiod .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } 59*3d8817e4Smiod .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 60*3d8817e4Smiod .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } 61*3d8817e4Smiod .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 62*3d8817e4Smiod .rel.bss ${RELOCATING-0} : { *(.rel.bss) } 63*3d8817e4Smiod .rela.bss ${RELOCATING-0} : { *(.rela.bss) } 64*3d8817e4Smiod .rel.plt ${RELOCATING-0} : { *(.rel.plt) } 65*3d8817e4Smiod .rela.plt ${RELOCATING-0} : { *(.rela.plt) } 66*3d8817e4Smiod .init ${RELOCATING-0} : { *(.init) } =${NOP-0} 67*3d8817e4Smiod ${DATA_PLT-${PLT}} 68*3d8817e4Smiod .text ${RELOCATING-0} : 69*3d8817e4Smiod { 70*3d8817e4Smiod ${RELOCATING+${TEXT_START_SYMBOLS}} 71*3d8817e4Smiod *(.text) 72*3d8817e4Smiod ${CONSTRUCTING+ __CTOR_LIST__ = .;} 73*3d8817e4Smiod ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)} 74*3d8817e4Smiod ${CONSTRUCTING+ *(.ctors)} 75*3d8817e4Smiod ${CONSTRUCTING+ LONG(0)} 76*3d8817e4Smiod ${CONSTRUCTING+ __CTOR_END__ = .;} 77*3d8817e4Smiod ${CONSTRUCTING+ __DTOR_LIST__ = .;} 78*3d8817e4Smiod ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)} 79*3d8817e4Smiod ${CONSTRUCTING+ *(.dtors)} 80*3d8817e4Smiod ${CONSTRUCTING+ LONG(0)} 81*3d8817e4Smiod ${CONSTRUCTING+ __DTOR_END__ = .;} 82*3d8817e4Smiod } 83*3d8817e4Smiod ${RELOCATING+_etext = .;} 84*3d8817e4Smiod ${RELOCATING+PROVIDE (etext = .);} 85*3d8817e4Smiod .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} 86*3d8817e4Smiod .ctors ${RELOCATING-0} : { *(.ctors) } 87*3d8817e4Smiod .dtors ${RELOCATING-0} : { *(.dtors) } 88*3d8817e4Smiod .rodata ${RELOCATING-0} : { *(.rodata) } 89*3d8817e4Smiod .rodata1 ${RELOCATING-0} : { *(.rodata1) } 90*3d8817e4Smiod ${OTHER_READONLY_SECTIONS} 91*3d8817e4Smiod 92*3d8817e4Smiod /* Read-write section, merged into data segment: */ 93*3d8817e4Smiod ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} 94*3d8817e4Smiod .data ${RELOCATING-0} : 95*3d8817e4Smiod { 96*3d8817e4Smiod ${RELOCATING+${DATA_START_SYMBOLS}} 97*3d8817e4Smiod *(.data) 98*3d8817e4Smiod ${CONSTRUCTING+CONSTRUCTORS} 99*3d8817e4Smiod } 100*3d8817e4Smiod .data1 ${RELOCATING-0} : { *(.data1) } 101*3d8817e4Smiod ${OTHER_READWRITE_SECTIONS} 102*3d8817e4Smiod .got ${RELOCATING-0} : { *(.got.plt) *(.got) } 103*3d8817e4Smiod .dynamic ${RELOCATING-0} : { *(.dynamic) } 104*3d8817e4Smiod ${DATA_PLT+${PLT}} 105*3d8817e4Smiod /* We want the small data sections together, so single-instruction offsets 106*3d8817e4Smiod can access them all, and initialized data all before uninitialized, so 107*3d8817e4Smiod we can shorten the on-disk segment size. */ 108*3d8817e4Smiod .sdata ${RELOCATING-0} : { *(.sdata) } 109*3d8817e4Smiod ${RELOCATING+_edata = .;} 110*3d8817e4Smiod ${RELOCATING+PROVIDE (edata = .);} 111*3d8817e4Smiod ${RELOCATING+__bss_start = .;} 112*3d8817e4Smiod ${RELOCATING+${OTHER_BSS_SYMBOLS}} 113*3d8817e4Smiod .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } 114*3d8817e4Smiod .bss ${RELOCATING-0} : 115*3d8817e4Smiod { 116*3d8817e4Smiod *(.dynbss) 117*3d8817e4Smiod *(.bss) 118*3d8817e4Smiod *(COMMON) 119*3d8817e4Smiod } 120*3d8817e4Smiod ${RELOCATING+_end = . ;} 121*3d8817e4Smiod ${RELOCATING+PROVIDE (end = .);} 122*3d8817e4Smiod 123*3d8817e4Smiod /* These are needed for ELF backends which have not yet been 124*3d8817e4Smiod converted to the new style linker. */ 125*3d8817e4Smiod .stab 0 : { *(.stab) } 126*3d8817e4Smiod .stabstr 0 : { *(.stabstr) } 127*3d8817e4Smiod 128*3d8817e4Smiod ${OTHER_SECTIONS} 129*3d8817e4Smiod} 130*3d8817e4SmiodEOF 131