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