1# Copyright (C) 2014-2017 Free Software Foundation, Inc.
2# 
3# Copying and distribution of this file, with or without modification,
4# are permitted in any medium without royalty provided the copyright
5# notice and this notice are preserved.
6
7cat << EOF
8/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
9
10   Copying and distribution of this script, with or without modification,
11   are permitted in any medium without royalty provided the copyright
12   notice and this notice are preserved.  */
13
14OUTPUT_FORMAT("elf32-v850", "elf32-v850",
15	      "elf32-v850")
16OUTPUT_ARCH(v850:old-gcc-abi)
17${RELOCATING+ENTRY(_start)}
18SEARCH_DIR(.);
19${RELOCATING+EXTERN(__ctbp __ep __gp)};
20SECTIONS
21{
22  /* This saves a little space in the ELF file, since the zda starts
23     at a higher location that the ELF headers take up.  */
24
25  .zdata ${ZDATA_START_ADDR} :
26  {
27	*(.zdata)
28	*(.zbss)
29	*(reszdata)
30	*(.zcommon)
31  }
32
33  /* This is the read only part of the zero data area.
34     Having it as a separate section prevents its
35     attributes from being inherited by the zdata
36     section.  Specifically it prevents the zdata
37     section from being marked READONLY.  */
38
39  .rozdata ${ROZDATA_START_ADDR} :
40  {
41	*(.rozdata)
42	*(romzdata)
43	*(romzbss)
44  }
45
46  /* Read-only sections, merged into text segment.  */
47  . = ${TEXT_START_ADDR};
48  .interp	: { *(.interp) }
49  .hash		: { *(.hash) }
50  .dynsym	: { *(.dynsym) }
51  .dynstr	: { *(.dynstr) }
52  .rel.text	: { *(.rel.text) }
53  .rela.text	: { *(.rela.text) }
54  .rel.data	: { *(.rel.data) }
55  .rela.data	: { *(.rela.data) }
56  .rel.rodata	: { *(.rel.rodata) }
57  .rela.rodata	: { *(.rela.rodata) }
58  .rel.gcc_except_table : { *(.rel.gcc_except_table) }
59  .rela.gcc_except_table : { *(.rela.gcc_except_table) }
60  .rel.got	: { *(.rel.got) }
61  .rela.got	: { *(.rela.got) }
62  .rel.ctors	: { *(.rel.ctors) }
63  .rela.ctors	: { *(.rela.ctors) }
64  .rel.dtors	: { *(.rel.dtors) }
65  .rela.dtors	: { *(.rela.dtors) }
66  .rel.init	: { *(.rel.init) }
67  .rela.init	: { *(.rela.init) }
68  .rel.fini	: { *(.rel.fini) }
69  .rela.fini	: { *(.rela.fini) }
70  .rel.bss	: { *(.rel.bss) }
71  .rela.bss	: { *(.rela.bss) }
72  .rel.plt	: { *(.rel.plt) }
73  .rela.plt	: { *(.rela.plt) }
74  .init		: { KEEP (*(.init)) } =0
75  .plt		: { *(.plt) }
76
77  .text		:
78  {
79    *(.text)
80    ${RELOCATING+*(.text.*)}
81    
82    /* .gnu.warning sections are handled specially by elf32.em.  */
83    *(.gnu.warning)
84    *(.gnu.linkonce.t*)
85  } =0
86
87  ${RELOCATING+_etext = .;}
88  ${RELOCATING+PROVIDE (etext = .);}
89
90   /* This is special code area at the end of the normal text section.
91      It contains a small lookup table at the start followed by the
92      code pointed to by entries in the lookup table.  */
93
94  .call_table_data ${CALL_TABLE_START_ADDR} :
95  {
96    ${RELOCATING+PROVIDE(__ctbp = .);}
97    *(.call_table_data)
98  } = 0xff   /* Fill gaps with 0xff.  */
99  
100  .call_table_text :
101  {
102    *(.call_table_text)
103  }
104
105  .fini		: { KEEP (*(.fini)) } =0
106  .rodata	: { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) }
107  .rodata1	: { *(.rodata1) }
108
109  .data		:
110  {
111    *(.data)
112    ${RELOCATING+*(.data.*)}
113    *(.gnu.linkonce.d*)
114    CONSTRUCTORS
115  }
116  .data1	: { *(.data1) }
117  .ctors	:
118  {
119    ${CONSTRUCTING+___ctors = .;}
120    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
121    KEEP (*(SORT(.ctors.*)))
122    KEEP (*crtend(.ctors))
123    ${CONSTRUCTING+___ctors_end = .;}
124  }
125  .dtors	:
126  {
127    ${CONSTRUCTING+___dtors = .;}
128    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
129    KEEP (*(SORT(.dtors.*)))
130    KEEP (*crtend.o(.dtors))
131    ${CONSTRUCTING+___dtors_end = .;}
132  }
133  .jcr		:
134  {
135    KEEP (*(.jcr))
136  }
137
138  .gcc_except_table : { *(.gcc_except_table) }
139
140  .got		: { *(.got.plt) *(.got) }
141  .dynamic	: { *(.dynamic) }
142
143  .tdata ${TDATA_START_ADDR} :
144  {
145	${RELOCATING+PROVIDE (__ep = .);}
146	*(.tbyte)
147	*(.tcommon_byte)
148	*(.tdata)
149	*(.tbss)
150	*(.tcommon)
151  }
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     
157  .sdata ${SDATA_START_ADDR} :
158  {
159	${RELOCATING+PROVIDE (__gp = . + 0x8000);}
160	*(.sdata)
161   }
162
163  /* See comment about .rozdata. */
164  .rosdata ${ROSDATA_START_ADDR} :
165  {
166	*(.rosdata)
167  }
168
169  /* We place the .sbss data section AFTER the .rosdata section, so that
170     it can directly precede the .bss section.  This allows runtime startup
171     code to initialise all the zero-data sections by simply taking the
172     value of '_edata' and zeroing until it reaches '_end'.  */
173     
174  .sbss :
175  {
176	${RELOCATING+__sbss_start = .;}
177	*(.sbss)
178	*(.scommon)
179  }
180
181  ${RELOCATING+_edata  = DEFINED (__sbss_start) ? __sbss_start : . ;}
182  ${RELOCATING+PROVIDE (edata = _edata);}
183
184  .bss       :
185  {
186	${RELOCATING+__bss_start = DEFINED (__sbss_start) ? __sbss_start : . ;}
187	${RELOCATING+__real_bss_start = . ;}
188	*(.dynbss)
189	*(.bss)
190	*(COMMON)
191  }
192
193  ${RELOCATING+_end = . ;}
194  ${RELOCATING+PROVIDE (end = .);}
195  ${RELOCATING+PROVIDE (_heap_start = .);}
196
197  .note.renesas 0 : { KEEP(*(.note.renesas)) }  
198
199  /* Stabs debugging sections.  */
200  .stab 0		: { *(.stab) }
201  .stabstr 0		: { *(.stabstr) }
202  .stab.excl 0		: { *(.stab.excl) }
203  .stab.exclstr 0	: { *(.stab.exclstr) }
204  .stab.index 0		: { *(.stab.index) }
205  .stab.indexstr 0	: { *(.stab.indexstr) }
206  .comment 0		: { *(.comment) }
207
208EOF
209
210. $srcdir/scripttempl/DWARF.sc
211
212cat <<EOF
213  /* User stack.  */
214  .stack 0x200000	:
215  {
216	${RELOCATING+__stack = .;}
217	*(.stack)
218  }
219}
220EOF
221