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