OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [ld/] [scripttempl/] [iq2000.sc] - Blame information for rev 156

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
#
2
# Unusual variables checked by this code:
3
#       NOP - four byte opcode for no-op (defaults to 0)
4
#       DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
5
#       INITIAL_READONLY_SECTIONS - at start of data segment
6
#       OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
7
#               (e.g., .PARISC.milli)
8
#       OTHER_TEXT_SECTIONS - these get put in .text when relocating
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_GOT_SYMBOLS - symbols defined just before .got.
19
#       OTHER_GOT_SECTIONS - sections just after .got.
20
#       OTHER_SDATA_SECTIONS - sections just after .sdata.
21
#       OTHER_BSS_SYMBOLS - symbols that appear at the start of the
22
#               .bss section besides __bss_start.
23
#       DATA_PLT - .plt should be in data segment, not text segment.
24
#       BSS_PLT - .plt should be in bss segment
25
#       TEXT_DYNAMIC - .dynamic in text segment, not data segment.
26
#       EMBEDDED - whether this is for an embedded system.
27
#       SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
28
#               start address of shared library.
29
#       INPUT_FILES - INPUT command of files to always include
30
#       WRITABLE_RODATA - if set, the .rodata section should be writable
31
#       INIT_START, INIT_END -  statements just before and just after
32
#       combination of .init sections.
33
#       FINI_START, FINI_END - statements just before and just after
34
#       combination of .fini sections.
35
#
36
# When adding sections, do note that the names of some sections are used
37
# when specifying the start address of the next.
38
#
39
 
40
#  Many sections come in three flavours.  There is the 'real' section,
41
#  like ".data".  Then there are the per-procedure or per-variable
42
#  sections, generated by -ffunction-sections and -fdata-sections in GCC,
43
#  and useful for --gc-sections, which for a variable "foo" might be
44
#  ".data.foo".  Then there are the linkonce sections, for which the linker
45
#  eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
46
#  The exact correspondences are:
47
#
48
#  Section      Linkonce section
49
#  .text        .gnu.linkonce.t.foo
50
#  .rodata      .gnu.linkonce.r.foo
51
#  .data        .gnu.linkonce.d.foo
52
#  .bss         .gnu.linkonce.b.foo
53
#  .sdata       .gnu.linkonce.s.foo
54
#  .sbss        .gnu.linkonce.sb.foo
55
#  .sdata2      .gnu.linkonce.s2.foo
56
#  .sbss2       .gnu.linkonce.sb2.foo
57
#
58
#  Each of these can also have corresponding .rel.* and .rela.* sections.
59
 
60
test -z "$ENTRY" && ENTRY=_start
61
test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
62
test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
63
if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
64
test -z "${ELFSIZE}" && ELFSIZE=32
65
test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
66
test "$LD_FLAG" = "N" && DATA_ADDR=.
67
INTERP=".interp   ${RELOCATING-0} : { *(.interp)        }"
68
PLT=".plt    ${RELOCATING-0} : { *(.plt)        }"
69
DYNAMIC=".dynamic     ${RELOCATING-0} : { *(.dynamic) }"
70
RODATA=".rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} }"
71
SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) ${RELOCATING+*(.sbss2.*)} ${RELOCATING+*(.gnu.linkonce.sb2.*)} }"
72
SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) ${RELOCATING+*(.sdata2.*)} ${RELOCATING+*(.gnu.linkonce.s2.*)} }"
73
CTOR=".ctors ${CONSTRUCTING-0} :
74
  {
75
    ${CONSTRUCTING+${CTOR_START}}
76
    /* gcc uses crtbegin.o to find the start of
77
       the constructors, so we make sure it is
78
       first.  Because this is a wildcard, it
79
       doesn't matter if the user does not
80
       actually link against crtbegin.o; the
81
       linker won't look for a file to match a
82
       wildcard.  The wildcard also means that it
83
       doesn't matter which directory crtbegin.o
84
       is in.  */
85
 
86
    KEEP (*crtbegin.o(.ctors))
87
    KEEP (*crtbegin?.o(.ctors))
88
 
89
    /* We don't want to include the .ctor section from
90
       the crtend.o file until after the sorted ctors.
91
       The .ctor section from the crtend file contains the
92
       end of ctors marker and it must be last */
93
 
94
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
95
    KEEP (*(SORT(.ctors.*)))
96
    KEEP (*(.ctors))
97
    ${CONSTRUCTING+${CTOR_END}}
98
  }"
99
 
100
DTOR=" .dtors       ${CONSTRUCTING-0} :
101
  {
102
    ${CONSTRUCTING+${DTOR_START}}
103
    KEEP (*crtbegin.o(.dtors))
104
    KEEP (*crtbegin?.o(.dtors))
105
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
106
    KEEP (*(SORT(.dtors.*)))
107
    KEEP (*(.dtors))
108
    ${CONSTRUCTING+${DTOR_END}}
109
  }"
110
 
111
# if this is for an embedded system, don't add SIZEOF_HEADERS.
112
if [ -z "$EMBEDDED" ]; then
113
   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS"
114
else
115
   test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
116
fi
117
 
118
cat <
119
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
120
              "${LITTLE_OUTPUT_FORMAT}")
121
OUTPUT_ARCH(${OUTPUT_ARCH})
122
${RELOCATING+ENTRY(${ENTRY})}
123
 
124
${RELOCATING+${LIB_SEARCH_DIRS}}
125
${RELOCATING+/* Do we need any of these for elf?
126
   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
127
${RELOCATING+${EXECUTABLE_SYMBOLS}}
128
${RELOCATING+${INPUT_FILES}}
129
${RELOCATING- /* For some reason, the Solaris linker makes bad executables
130
  if gld -r is used and the intermediate file has sections starting
131
  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
132
  bug.  But for now assigning the zero vmas works.  */}
133
 
134
SECTIONS
135
{
136
  ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_BASE_ADDRESS};}}
137
  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
138
  ${CREATE_SHLIB-${INTERP}}
139
  ${TEXT_DYNAMIC+${DYNAMIC}}
140
 
141
EOF
142
if [ "x$COMBRELOC" = x ]; then
143
  COMBRELOCCAT=cat
144
else
145
  COMBRELOCCAT="cat > $COMBRELOC"
146
fi
147
eval $COMBRELOCCAT <
148
  .rel.init    ${RELOCATING-0} : { *(.rel.init) }
149
  .rela.init   ${RELOCATING-0} : { *(.rela.init)        }
150
  .rel.text    ${RELOCATING-0} :
151
    {
152
      *(.rel.text)
153
      ${RELOCATING+*(.rel.text.*)}
154
      ${RELOCATING+*(.rel.gnu.linkonce.t.*)}
155
    }
156
  .rela.text   ${RELOCATING-0} :
157
    {
158
      *(.rela.text)
159
      ${RELOCATING+*(.rela.text.*)}
160
      ${RELOCATING+*(.rela.gnu.linkonce.t.*)}
161
    }
162
  .rel.fini    ${RELOCATING-0} : { *(.rel.fini) }
163
  .rela.fini   ${RELOCATING-0} : { *(.rela.fini)        }
164
  .rel.rodata  ${RELOCATING-0} :
165
    {
166
      *(.rel.rodata)
167
      ${RELOCATING+*(.rel.rodata.*)}
168
      ${RELOCATING+*(.rel.gnu.linkonce.r.*)}
169
    }
170
  .rela.rodata ${RELOCATING-0} :
171
    {
172
      *(.rela.rodata)
173
      ${RELOCATING+*(.rela.rodata.*)}
174
      ${RELOCATING+*(.rela.gnu.linkonce.r.*)}
175
    }
176
  ${OTHER_READONLY_RELOC_SECTIONS}
177
  .rel.data    ${RELOCATING-0} :
178
    {
179
      *(.rel.data)
180
      ${RELOCATING+*(.rel.data.*)}
181
      ${RELOCATING+*(.rel.gnu.linkonce.d.*)}
182
    }
183
  .rela.data   ${RELOCATING-0} :
184
    {
185
      *(.rela.data)
186
      ${RELOCATING+*(.rela.data.*)}
187
      ${RELOCATING+*(.rela.gnu.linkonce.d.*)}
188
    }
189
  .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)        }
190
  .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)       }
191
  .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)        }
192
  .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)       }
193
  .rel.got     ${RELOCATING-0} : { *(.rel.got)          }
194
  .rela.got    ${RELOCATING-0} : { *(.rela.got)         }
195
  ${OTHER_GOT_RELOC_SECTIONS}
196
  .rel.sdata   ${RELOCATING-0} :
197
    {
198
      *(.rel.sdata)
199
      ${RELOCATING+*(.rel.sdata.*)}
200
      ${RELOCATING+*(.rel.gnu.linkonce.s.*)}
201
    }
202
  .rela.sdata   ${RELOCATING-0} :
203
    {
204
      *(.rela.sdata)
205
      ${RELOCATING+*(.rela.sdata.*)}
206
      ${RELOCATING+*(.rela.gnu.linkonce.s.*)}
207
    }
208
  .rel.sbss    ${RELOCATING-0} :
209
    {
210
      *(.rel.sbss)
211
      ${RELOCATING+*(.rel.sbss.*)}
212
      ${RELOCATING+*(.rel.gnu.linkonce.sb.*)}
213
    }
214
  .rela.sbss   ${RELOCATING-0} :
215
    {
216
      *(.rela.sbss)
217
      ${RELOCATING+*(.rela.sbss.*)}
218
      ${RELOCATING+*(.rela.gnu.linkonce.sb.*)}
219
    }
220
  .rel.sdata2  ${RELOCATING-0} :
221
    {
222
      *(.rel.sdata2)
223
      ${RELOCATING+*(.rel.sdata2.*)}
224
      ${RELOCATING+*(.rel.gnu.linkonce.s2.*)}
225
    }
226
  .rela.sdata2 ${RELOCATING-0} :
227
    {
228
      *(.rela.sdata2)
229
      ${RELOCATING+*(.rela.sdata2.*)}
230
      ${RELOCATING+*(.rela.gnu.linkonce.s2.*)}
231
    }
232
  .rel.sbss2   ${RELOCATING-0} :
233
    {
234
      *(.rel.sbss2)
235
      ${RELOCATING+*(.rel.sbss2.*)}
236
      ${RELOCATING+*(.rel.gnu.linkonce.sb2.*)}
237
    }
238
  .rela.sbss2  ${RELOCATING-0} :
239
    {
240
      *(.rela.sbss2)
241
      ${RELOCATING+*(.rela.sbss2.*)}
242
      ${RELOCATING+*(.rela.gnu.linkonce.sb2.*)}
243
    }
244
  .rel.bss     ${RELOCATING-0} :
245
    {
246
      *(.rel.bss)
247
      ${RELOCATING+*(.rel.bss.*)}
248
      ${RELOCATING+*(.rel.gnu.linkonce.b.*)}
249
    }
250
  .rela.bss    ${RELOCATING-0} :
251
    {
252
      *(.rela.bss)
253
      ${RELOCATING+*(.rela.bss.*)}
254
      ${RELOCATING+*(.rela.gnu.linkonce.b.*)}
255
    }
256
EOF
257
if [ -n "$COMBRELOC" ]; then
258
cat <
259
  .rel.dyn       :
260
    {
261
EOF
262
sed -e '/^[     ]*[{}][         ]*$/d;/:[       ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/      \1/' $COMBRELOC
263
cat <
264
    }
265
  .rela.dyn      :
266
    {
267
EOF
268
sed -e '/^[     ]*[{}][         ]*$/d;/:[       ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/      \1/' $COMBRELOC
269
cat <
270
    }
271
EOF
272
fi
273
cat <
274
  .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
275
  .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
276
  ${OTHER_PLT_RELOC_SECTIONS}
277
 
278
  .init        ${RELOCATING-0} :
279
  {
280
    ${RELOCATING+${INIT_START}}
281
    KEEP (*(.init))
282
    ${RELOCATING+${INIT_END}}
283
  } =${NOP-0}
284
 
285
  ${DATA_PLT-${BSS_PLT-${PLT}}}
286
  .text    ${RELOCATING-0} :
287
  {
288
    ${RELOCATING+${TEXT_START_SYMBOLS}}
289
    *(.text)
290
    ${RELOCATING+*(.text.*)}
291
    *(.stub)
292
    /* .gnu.warning sections are handled specially by elf32.em.  */
293
    *(.gnu.warning)
294
    ${RELOCATING+*(.gnu.linkonce.t.*)}
295
    ${RELOCATING+${OTHER_TEXT_SECTIONS}}
296
  } =${NOP-0}
297
  .fini    ${RELOCATING-0} :
298
  {
299
    ${RELOCATING+${FINI_START}}
300
    KEEP (*(.fini))
301
    ${RELOCATING+${FINI_END}}
302
  } =${NOP-0}
303
  ${RELOCATING+PROVIDE (__etext = .);}
304
  ${RELOCATING+PROVIDE (_etext = .);}
305
  ${RELOCATING+PROVIDE (etext = .);}
306
 
307
  /* Adjust the address for the data segment.  We want to adjust up to
308
     the same address within the page on the next page up.  */
309
  ${CREATE_SHLIB-${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}}
310
  ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))};}}
311
 
312
  .data  ${RELOCATING-0} :
313
  {
314
    ${RELOCATING+${DATA_START_SYMBOLS}}
315
    *(.data)
316
    ${RELOCATING+*(.data.*)}
317
    ${RELOCATING+*(.gnu.linkonce.d.*)}
318
    ${CONSTRUCTING+SORT(CONSTRUCTORS)}
319
  }
320
  .data1 ${RELOCATING-0} : { *(.data1) }
321
  .eh_frame ${RELOCATING-0} :
322
  {
323
    ${RELOCATING+PROVIDE (__eh_frame_begin = .);}
324
    *(.eh_frame)
325
    LONG (0);
326
    ${RELOCATING+PROVIDE (__eh_frame_end = .);}
327
  } ${RELOCATING+}
328
  .gcc_except_table : { *(.gcc_except_table) }
329
  ${INITIAL_READONLY_SECTIONS}
330
  .hash        ${RELOCATING-0} : { *(.hash)             }
331
  .dynsym      ${RELOCATING-0} : { *(.dynsym)           }
332
  .dynstr      ${RELOCATING-0} : { *(.dynstr)           }
333
  .gnu.version ${RELOCATING-0} : { *(.gnu.version)      }
334
  .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d)  }
335
  .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r)  }
336
  ${RODATA}
337
  .rodata1 ${RELOCATING-0} : { *(.rodata1) }
338
  ${CREATE_SHLIB-${SDATA2}}
339
  ${CREATE_SHLIB-${SBSS2}}
340
  ${RELOCATING+${OTHER_READONLY_SECTIONS}}
341
  ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
342
  ${TEXT_DYNAMIC-${DYNAMIC}}
343
  ${RELOCATING+${CTOR}}
344
  ${RELOCATING+${DTOR}}
345
  .jcr : { KEEP (*(.jcr)) }
346
  ${DATA_PLT+${PLT}}
347
  ${RELOCATING+${OTHER_GOT_SYMBOLS}}
348
  .got          ${RELOCATING-0} : { *(.got.plt) *(.got) }
349
  ${RELOCATING+${OTHER_GOT_SECTIONS}}
350
  ${CREATE_SHLIB+${SDATA2}}
351
  ${CREATE_SHLIB+${SBSS2}}
352
  /* We want the small data sections together, so single-instruction offsets
353
     can access them all, and initialized data all before uninitialized, so
354
     we can shorten the on-disk segment size.  */
355
  .sdata   ${RELOCATING-0} :
356
  {
357
    ${RELOCATING+${SDATA_START_SYMBOLS}}
358
    *(.sdata)
359
    ${RELOCATING+*(.sdata.*)}
360
    ${RELOCATING+*(.gnu.linkonce.s.*)}
361
  }
362
  ${RELOCATING+${OTHER_SDATA_SECTIONS}}
363
  ${RELOCATING+_edata = .;}
364
  ${RELOCATING+PROVIDE (edata = .);}
365
  ${RELOCATING+__bss_start = .;}
366
  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
367
  .sbss    ${RELOCATING-0} :
368
  {
369
    ${RELOCATING+PROVIDE (__sbss_start = .);}
370
    ${RELOCATING+PROVIDE (___sbss_start = .);}
371
    *(.dynsbss)
372
    *(.sbss)
373
    ${RELOCATING+*(.sbss.*)}
374
    ${RELOCATING+*(.gnu.linkonce.sb.*)}
375
    *(.scommon)
376
    ${RELOCATING+PROVIDE (__sbss_end = .);}
377
    ${RELOCATING+PROVIDE (___sbss_end = .);}
378
  }
379
  ${BSS_PLT+${PLT}}
380
  .bss     ${RELOCATING-0} :
381
  {
382
   *(.dynbss)
383
   *(.bss)
384
   ${RELOCATING+*(.bss.*)}
385
   ${RELOCATING+*(.gnu.linkonce.b.*)}
386
   *(COMMON)
387
   /* Align here to ensure that the .bss section occupies space up to
388
      _end.  Align after .bss to ensure correct alignment even if the
389
      .bss section disappears because there are no input sections.  */
390
   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
391
  }
392
  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
393
  ${RELOCATING+. = ALIGN(${ALIGNMENT});}
394
  ${RELOCATING+${OTHER_END_SYMBOLS}}
395
  ${RELOCATING+_end = .;}
396
  ${RELOCATING+PROVIDE (end = .);}
397
 
398
  /* Stabs debugging sections.  */
399
  .stab 0 : { *(.stab) }
400
  .stabstr 0 : { *(.stabstr) }
401
  .stab.excl 0 : { *(.stab.excl) }
402
  .stab.exclstr 0 : { *(.stab.exclstr) }
403
  .stab.index 0 : { *(.stab.index) }
404
  .stab.indexstr 0 : { *(.stab.indexstr) }
405
 
406
  .comment 0 : { *(.comment) }
407
 
408
  /* DWARF debug sections.
409
     Symbols in the DWARF debugging sections are relative to the beginning
410
     of the section so we begin them at 0.  */
411
 
412
  /* DWARF 1 */
413
  .debug          0 : { *(.debug) }
414
  .line           0 : { *(.line) }
415
 
416
  /* GNU DWARF 1 extensions */
417
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
418
  .debug_sfnames  0 : { *(.debug_sfnames) }
419
 
420
  /* DWARF 1.1 and DWARF 2 */
421
  .debug_aranges  0 : { *(.debug_aranges) }
422
  .debug_pubnames 0 : { *(.debug_pubnames) }
423
 
424
  /* DWARF 2 */
425
  .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
426
  .debug_abbrev   0 : { *(.debug_abbrev) }
427
  .debug_line     0 : { *(.debug_line) }
428
  .debug_frame    0 : { *(.debug_frame) }
429
  .debug_str      0 : { *(.debug_str) }
430
  .debug_loc      0 : { *(.debug_loc) }
431
  .debug_macinfo  0 : { *(.debug_macinfo) }
432
 
433
  /* SGI/MIPS DWARF 2 extensions */
434
  .debug_weaknames 0 : { *(.debug_weaknames) }
435
  .debug_funcnames 0 : { *(.debug_funcnames) }
436
  .debug_typenames 0 : { *(.debug_typenames) }
437
  .debug_varnames  0 : { *(.debug_varnames) }
438
 
439
  ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
440
 
441
  /* These must appear regardless of ${RELOCATING}.  */
442
  ${OTHER_SECTIONS}
443
}
444
EOF

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.