1# 2# This is just a raw copy of elfppc.sc and has not been otherwise modified 3# 4# Unusual variables checked by this code: 5# NOP - four byte opcode for no-op (defaults to 0) 6# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start 7# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... 8# (e.g., .PARISC.milli) 9# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... 10# (e.g., .PARISC.global) 11# OTHER_SECTIONS - at the end 12# EXECUTABLE_SYMBOLS - symbols that must be defined for an 13# executable (e.g., _DYNAMIC_LINK) 14# TEXT_START_SYMBOLS - symbols that appear at the start of the 15# .text section. 16# DATA_START_SYMBOLS - symbols that appear at the start of the 17# .data section. 18# OTHER_BSS_SYMBOLS - symbols that appear at the start of the 19# .bss section besides __bss_start. 20# 21# When adding sections, do note that the names of some sections are used 22# when specifying the start address of the next. 23# 24test -z "$ENTRY" && ENTRY=_start 25test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} 26test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 27test "$LD_FLAG" = "N" && DATA_ADDR=. 28SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }" 29SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }" 30INTERP=".interp ${RELOCATING-0} : { *(.interp) }" 31PLT=".plt ${RELOCATING-0} : { *(.plt) }" 32cat <<EOF 33OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", 34 "${LITTLE_OUTPUT_FORMAT}") 35OUTPUT_ARCH(${ARCH}) 36ENTRY(${ENTRY}) 37 38${RELOCATING+${LIB_SEARCH_DIRS}} 39${RELOCATING+/* Do we need any of these for elf? 40 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} 41${RELOCATING+${EXECUTABLE_SYMBOLS}} 42${RELOCATING- /* For some reason, the Solaris linker makes bad executables 43 if gld -r is used and the intermediate file has sections starting 44 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld 45 bug. But for now assigning the zero vmas works. */} 46 47${RELOCATING+PROVIDE (__stack = 0);} 48SECTIONS 49{ 50 /* Read-only sections, merged into text segment: */ 51 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} 52 ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} 53 ${CREATE_SHLIB-${INTERP}} 54 .hash ${RELOCATING-0} : { *(.hash) } 55 .dynsym ${RELOCATING-0} : { *(.dynsym) } 56 .dynstr ${RELOCATING-0} : { *(.dynstr) } 57 .gnu.version ${RELOCATING-0} : { *(.gnu.version) } 58 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } 59 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } 60 .rela.text ${RELOCATING-0} : 61 { *(.rela.text) *(.rela.gnu.linkonce.t*) } 62 .rela.data ${RELOCATING-0} : 63 { *(.rela.data) *(.rela.gnu.linkonce.d*) } 64 .rela.rodata ${RELOCATING-0} : 65 { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } 66 .rela.got ${RELOCATING-0} : { *(.rela.got) } 67 .rela.got1 ${RELOCATING-0} : { *(.rela.got1) } 68 .rela.got2 ${RELOCATING-0} : { *(.rela.got2) } 69 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 70 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 71 .rela.init ${RELOCATING-0} : { *(.rela.init) } 72 .rela.fini ${RELOCATING-0} : { *(.rela.fini) } 73 .rela.bss ${RELOCATING-0} : { *(.rela.bss) } 74 .rela.plt ${RELOCATING-0} : { *(.rela.plt) } 75 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } 76 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } 77 .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) } 78 .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) } 79 .text ${RELOCATING-0} : 80 { 81 ${RELOCATING+${TEXT_START_SYMBOLS}} 82 *(.text) 83 /* .gnu.warning sections are handled specially by elf32.em. */ 84 *(.gnu.warning) 85 *(.gnu.linkonce.t*) 86 } =${NOP-0} 87 .init ${RELOCATING-0} : { *(.init) } =${NOP-0} 88 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} 89 .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) } 90 .rodata1 ${RELOCATING-0} : { *(.rodata1) } 91 ${RELOCATING+_etext = .;} 92 ${RELOCATING+PROVIDE (etext = .);} 93 ${CREATE_SHLIB-${SDATA2}} 94 ${CREATE_SHLIB-${SBSS2}} 95 ${OTHER_READONLY_SECTIONS} 96 97 /* Adjust the address for the data segment. We want to adjust up to 98 the same address within the page on the next page up. It would 99 be more correct to do this: 100 ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};} 101 The current expression does not correctly handle the case of a 102 text segment ending precisely at the end of a page; it causes the 103 data segment to skip a page. The above expression does not have 104 this problem, but it will currently (2/95) cause BFD to allocate 105 a single segment, combining both text and data, for this case. 106 This will prevent the text segment from being shared among 107 multiple executions of the program; I think that is more 108 important than losing a page of the virtual address space (note 109 that no actual memory is lost; the page which is skipped can not 110 be referenced). */ 111 ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} 112 113 .data ${RELOCATING-0} : 114 { 115 ${RELOCATING+${DATA_START_SYMBOLS}} 116 *(.data) 117 *(.gnu.linkonce.d*) 118 ${CONSTRUCTING+CONSTRUCTORS} 119 } 120 .data1 ${RELOCATING-0} : { *(.data1) } 121 ${OTHER_READWRITE_SECTIONS} 122 123 .got1 ${RELOCATING-0} : { *(.got1) } 124 .dynamic ${RELOCATING-0} : { *(.dynamic) } 125 126 /* Put .ctors and .dtors next to the .got2 section, so that the pointers 127 get relocated with -mrelocatable. Also put in the .fixup pointers. 128 The current compiler no longer needs this, but keep it around for 2.7.2 */ 129 130 ${RELOCATING+PROVIDE (_GOT2_START_ = .);} 131 .got2 ${RELOCATING-0} : { *(.got2) } 132 133 ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);} 134 .ctors ${RELOCATING-0} : { *(.ctors) } 135 ${RELOCATING+PROVIDE (__CTOR_END__ = .);} 136 137 ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);} 138 .dtors ${RELOCATING-0} : { *(.dtors) } 139 ${RELOCATING+PROVIDE (__DTOR_END__ = .);} 140 141 ${RELOCATING+PROVIDE (_FIXUP_START_ = .);} 142 .fixup ${RELOCATING-0} : { *(.fixup) } 143 ${RELOCATING+PROVIDE (_FIXUP_END_ = .);} 144 ${RELOCATING+PROVIDE (_GOT2_END_ = .);} 145 146 ${RELOCATING+PROVIDE (_GOT_START_ = .);} 147 .got ${RELOCATING-0} : { *(.got) } 148 .got.plt ${RELOCATING-0} : { *(.got.plt) } 149 ${CREATE_SHLIB+${SDATA2}} 150 ${CREATE_SHLIB+${SBSS2}} 151 ${RELOCATING+PROVIDE (_GOT_END_ = .);} 152 153 /* We want the small data sections together, so single-instruction offsets 154 can access them all, and initialized data all before uninitialized, so 155 we can shorten the on-disk segment size. */ 156 .sdata ${RELOCATING-0} : { *(.sdata) } 157 ${RELOCATING+_edata = .;} 158 ${RELOCATING+PROVIDE (edata = .);} 159 .sbss ${RELOCATING-0} : 160 { 161 ${RELOCATING+PROVIDE (__sbss_start = .);} 162 *(.sbss) 163 *(.scommon) 164 *(.dynsbss) 165 ${RELOCATING+PROVIDE (__sbss_end = .);} 166 } 167 ${PLT} 168 .bss ${RELOCATING-0} : 169 { 170 ${RELOCATING+${OTHER_BSS_SYMBOLS}} 171 ${RELOCATING+PROVIDE (__bss_start = .);} 172 *(.dynbss) 173 *(.bss) 174 *(COMMON) 175 } 176 ${RELOCATING+_end = . ;} 177 ${RELOCATING+PROVIDE (end = .);} 178 179 /* These are needed for ELF backends which have not yet been 180 converted to the new style linker. */ 181 .stab 0 : { *(.stab) } 182 .stabstr 0 : { *(.stabstr) } 183 184 /* DWARF debug sections. 185 Symbols in the DWARF debugging sections are relative to the beginning 186 of the section so we begin them at 0. */ 187 188 /* DWARF 1 */ 189 .debug 0 : { *(.debug) } 190 .line 0 : { *(.line) } 191 192 /* GNU DWARF 1 extensions */ 193 .debug_srcinfo 0 : { *(.debug_srcinfo) } 194 .debug_sfnames 0 : { *(.debug_sfnames) } 195 196 /* DWARF 1.1 and DWARF 2 */ 197 .debug_aranges 0 : { *(.debug_aranges) } 198 .debug_pubnames 0 : { *(.debug_pubnames) } 199 200 /* DWARF 2 */ 201 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 202 .debug_abbrev 0 : { *(.debug_abbrev) } 203 .debug_line 0 : { *(.debug_line) } 204 .debug_frame 0 : { *(.debug_frame) } 205 .debug_str 0 : { *(.debug_str) } 206 .debug_loc 0 : { *(.debug_loc) } 207 .debug_macinfo 0 : { *(.debug_macinfo) } 208 209 /* SGI/MIPS DWARF 2 extensions */ 210 .debug_weaknames 0 : { *(.debug_weaknames) } 211 .debug_funcnames 0 : { *(.debug_funcnames) } 212 .debug_typenames 0 : { *(.debug_typenames) } 213 .debug_varnames 0 : { *(.debug_varnames) } 214 215 ${OTHER_SECTIONS} 216} 217EOF 218