Index: bfd/ChangeLog
[binutils.git] / ld / scripttempl / xstormy16.sc
blobd504e18107e2d13f6b983beb67b3a48eb3091557
2 # Unusual variables checked by this code:
3 #       NOP - two byte opcode for no-op (defaults to 0)
4 #       INITIAL_READONLY_SECTIONS - at start of text segment
5 #       OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
6 #               (e.g., .PARISC.milli)
7 #       OTHER_TEXT_SECTIONS - these get put in .text when relocating
8 #       OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
9 #               (e.g., .PARISC.global)
10 #       OTHER_BSS_SECTIONS - other than .bss .sbss ...
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 and .sdata.
20 #       OTHER_BSS_SYMBOLS - symbols that appear at the start of the
21 #               .bss section besides __bss_start.
22 #       INPUT_FILES - INPUT command of files to always include
23 #       INIT_START, INIT_END -  statements just before and just after
24 #       combination of .init sections.
25 #       FINI_START, FINI_END - statements just before and just after
26 #       combination of .fini sections.
28 # When adding sections, do note that the names of some sections are used
29 # when specifying the start address of the next.
32 #  Many sections come in three flavours.  There is the 'real' section,
33 #  like ".data".  Then there are the per-procedure or per-variable
34 #  sections, generated by -ffunction-sections and -fdata-sections in GCC,
35 #  and useful for --gc-sections, which for a variable "foo" might be
36 #  ".data.foo".  Then there are the linkonce sections, for which the linker
37 #  eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
38 #  The exact correspondences are:
40 #  Section      Linkonce section
41 #  .text        .gnu.linkonce.t.foo
42 #  .rodata      .gnu.linkonce.r.foo
43 #  .data        .gnu.linkonce.d.foo
44 #  .bss         .gnu.linkonce.b.foo
45 #  .sdata       .gnu.linkonce.s.foo
46 #  .sbss        .gnu.linkonce.sb.foo
47 #  .sdata2      .gnu.linkonce.s2.foo
48 #  .sbss2       .gnu.linkonce.sb2.foo
50 #  Each of these can also have corresponding .rel.* and .rela.* sections.
52 test -z "$ENTRY" && ENTRY=_start
53 test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
54 test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
55 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
56 test -z "${ELFSIZE}" && ELFSIZE=32
57 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
58 CTOR=".ctors ${CONSTRUCTING-0} : 
59   {
60     ${CONSTRUCTING+${CTOR_START}}
61     /* gcc uses crtbegin.o to find the start of
62        the constructors, so we make sure it is
63        first.  Because this is a wildcard, it
64        doesn't matter if the user does not
65        actually link against crtbegin.o; the
66        linker won't look for a file to match a
67        wildcard.  The wildcard also means that it
68        doesn't matter which directory crtbegin.o
69        is in.  */
71     KEEP (*crtbegin.o(.ctors))
73     /* We don't want to include the .ctor section from
74        from the crtend.o file until after the sorted ctors.
75        The .ctor section from the crtend file contains the
76        end of ctors marker and it must be last */
78     KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .ctors))
79     KEEP (*(SORT(.ctors.*)))
80     KEEP (*(.ctors))
81     ${CONSTRUCTING+${CTOR_END}}
82   } > ROM"
84 DTOR=" .dtors       ${CONSTRUCTING-0} :
85   {
86     ${CONSTRUCTING+${DTOR_START}}
87     KEEP (*crtbegin.o(.dtors))
88     KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .dtors))
89     KEEP (*(SORT(.dtors.*)))
90     KEEP (*(.dtors))
91     ${CONSTRUCTING+${DTOR_END}}
92   } > ROM"
94 cat <<EOF
95 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
96               "${LITTLE_OUTPUT_FORMAT}")
97 OUTPUT_ARCH(${OUTPUT_ARCH})
98 ENTRY(${ENTRY})
100 ${RELOCATING+${LIB_SEARCH_DIRS}}
101 ${RELOCATING+${EXECUTABLE_SYMBOLS}}
102 ${RELOCATING+${INPUT_FILES}}
103 ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
104   if gld -r is used and the intermediate file has sections starting
105   at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
106   bug.  But for now assigning the zero vmas works.  */}
108 /* There are two memory regions we care about, one from 0 through 0x7F00
109    that is RAM and one from 0x8000 up which is ROM.  */
110 MEMORY 
112   RAM (w) : ORIGIN = 0, LENGTH = 0x7F00
113   ROM (!w) : ORIGIN = 0x8000, LENGTH = 0xFF8000
116 SECTIONS
118   .data  ${RELOCATING-0} :
119   {
120     ${RELOCATING+${DATA_START_SYMBOLS}}
121     *(.data)
122     ${RELOCATING+*(.data.*)}
123     ${RELOCATING+*(.gnu.linkonce.d.*)}
124     ${CONSTRUCTING+SORT(CONSTRUCTORS)}
125   } > RAM
126   ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
127   ${RELOCATING+${OTHER_GOT_SYMBOLS}}
128   ${RELOCATING+${OTHER_GOT_SECTIONS}}
129   ${RELOCATING+_edata = .;}
130   ${RELOCATING+PROVIDE (edata = .);}
131   ${RELOCATING+__bss_start = .;}
132   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
133   .bss     ${RELOCATING-0} :
134   {
135    *(.dynbss)
136    *(.bss)
137    ${RELOCATING+*(.bss.*)}
138    ${RELOCATING+*(.gnu.linkonce.b.*)}
139    *(COMMON)
140    /* Align here to ensure that the .bss section occupies space up to
141       _end.  Align after .bss to ensure correct alignment even if the
142       .bss section disappears because there are no input sections.  */
143    ${RELOCATING+. = ALIGN(${ALIGNMENT});}
144   } > RAM
145   ${RELOCATING+${OTHER_BSS_SECTIONS}}
146   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
147   ${RELOCATING+__stack = .;}
148   ${RELOCATING+. = . + 4096;}
149   ${RELOCATING+_end = .;}
150   ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
151   ${RELOCATING+PROVIDE (end = .);}
153   /* Read-only sections in ROM.  */
154   .int_vec     ${RELOCATING-0} : { *(.int_vec)  } > ROM
156   .rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} } > ROM
157   ${RELOCATING+${CTOR}}
158   ${RELOCATING+${DTOR}}
159   .eh_frame : { KEEP (*(.eh_frame)) } > ROM
160   .gcc_except_table : { *(.gcc_except_table) } > ROM
161   .plt : { *(.plt) } > ROM
163   .text    ${RELOCATING-0} :
164   {
165     ${RELOCATING+${TEXT_START_SYMBOLS}}
166     *(.text)
167     ${RELOCATING+*(.text.*)}
168     *(.stub)
169     /* .gnu.warning sections are handled specially by elf32.em.  */
170     *(.gnu.warning)
171     ${RELOCATING+*(.gnu.linkonce.t.*)}
172     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
173   } > ROM =${NOP-0}
174   .init        ${RELOCATING-0} : 
175   { 
176     ${RELOCATING+${INIT_START}}
177     KEEP (*(.init))
178     ${RELOCATING+${INIT_END}}
179   } > ROM =${NOP-0}
180   .fini    ${RELOCATING-0} :
181   {
182     ${RELOCATING+${FINI_START}}
183     KEEP (*(.fini))
184     ${RELOCATING+${FINI_END}}
185   } > ROM =${NOP-0}
186   ${RELOCATING+PROVIDE (__etext = .);}
187   ${RELOCATING+PROVIDE (_etext = .);}
188   ${RELOCATING+PROVIDE (etext = .);}
189   ${RELOCATING+${OTHER_READONLY_SECTIONS}}
192   /* Stabs debugging sections.  */
193   .stab 0 : { *(.stab) }
194   .stabstr 0 : { *(.stabstr) }
195   .stab.excl 0 : { *(.stab.excl) }
196   .stab.exclstr 0 : { *(.stab.exclstr) }
197   .stab.index 0 : { *(.stab.index) }
198   .stab.indexstr 0 : { *(.stab.indexstr) }
200   .comment 0 : { *(.comment) }
202   /* DWARF debug sections.
203      Symbols in the DWARF debugging sections are relative to the beginning
204      of the section so we begin them at 0.  */
206   /* DWARF 1 */
207   .debug          0 : { *(.debug) }
208   .line           0 : { *(.line) }
210   /* GNU DWARF 1 extensions */
211   .debug_srcinfo  0 : { *(.debug_srcinfo) }
212   .debug_sfnames  0 : { *(.debug_sfnames) }
214   /* DWARF 1.1 and DWARF 2 */
215   .debug_aranges  0 : { *(.debug_aranges) }
216   .debug_pubnames 0 : { *(.debug_pubnames) }
218   /* DWARF 2 */
219   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
220   .debug_abbrev   0 : { *(.debug_abbrev) }
221   .debug_line     0 : { *(.debug_line) }
222   .debug_frame    0 : { *(.debug_frame) }
223   .debug_str      0 : { *(.debug_str) }
224   .debug_loc      0 : { *(.debug_loc) }
225   .debug_macinfo  0 : { *(.debug_macinfo) }
227   /* SGI/MIPS DWARF 2 extensions */
228   .debug_weaknames 0 : { *(.debug_weaknames) }
229   .debug_funcnames 0 : { *(.debug_funcnames) }
230   .debug_typenames 0 : { *(.debug_typenames) }
231   .debug_varnames  0 : { *(.debug_varnames) }
233   ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
235   /* These must appear regardless of ${RELOCATING}.  */
236   ${OTHER_SECTIONS}