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