xref: /netbsd-src/external/gpl3/binutils/dist/ld/scripttempl/elfd30v.sc (revision 96fc3e30a7c3f7bba53384bf41dad5f78306fac4)
1
2CTOR=".ctors ${CONSTRUCTING-0} :
3  {
4    ${CONSTRUCTING+ __CTOR_LIST__ = .; }
5    /* gcc uses crtbegin.o to find the start of
6       the constructors, so we make sure it is
7       first.  Because this is a wildcard, it
8       doesn't matter if the user does not
9       actually link against crtbegin.o; the
10       linker won't look for a file to match a
11       wildcard.  The wildcard also means that it
12       doesn't matter which directory crtbegin.o
13       is in.  */
14
15    KEEP (*crtbegin.o(.ctors))
16    KEEP (*crtbegin?.o(.ctors))
17
18    /* We don't want to include the .ctor section from
19       the crtend.o file until after the sorted ctors.
20       The .ctor section from the crtend file contains the
21       end of ctors marker and it must be last */
22
23    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
24    KEEP (*(SORT(.ctors.*)))
25    KEEP (*(.ctors))
26    ${CONSTRUCTING+ __CTOR_END__ = .; }
27  } ${RELOCATING+ > ${DATA_MEMORY}}"
28
29DTOR="  .dtors	${CONSTRUCTING-0} :
30  {
31    ${CONSTRUCTING+ __DTOR_LIST__ = .; }
32    KEEP (*crtbegin.o(.dtors))
33    KEEP (*crtbegin?.o(.dtors))
34    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
35    KEEP (*(SORT(.dtors.*)))
36    KEEP (*(.dtors))
37    ${CONSTRUCTING+ __DTOR_END__ = .; }
38  } ${RELOCATING+ > ${DATA_MEMORY}}"
39
40cat <<EOF
41OUTPUT_FORMAT("${OUTPUT_FORMAT}")
42OUTPUT_ARCH(${ARCH})
43
44MEMORY
45{
46  text ${TEXT_DEF_SECTION} : ORIGIN = ${TEXT_START_ADDR}, LENGTH = ${TEXT_SIZE}
47  data ${DATA_DEF_SECTION} : ORIGIN = ${DATA_START_ADDR}, LENGTH = ${DATA_SIZE}
48  emem ${EMEM_DEF_SECTION} : ORIGIN = ${EMEM_START_ADDR}, LENGTH = ${EMEM_SIZE}
49  eit			   : ORIGIN = ${EIT_START_ADDR},  LENGTH = ${EIT_SIZE}
50}
51
52SECTIONS
53{
54  /* Read-only sections, merged into text segment: */
55  ${TEXT_DYNAMIC+${DYNAMIC}}
56  .hash			${RELOCATING-0} : { *(.hash) }
57  .dynsym		${RELOCATING-0} : { *(.dynsym) }
58  .dynstr		${RELOCATING-0} : { *(.dynstr) }
59  .gnu.version		${RELOCATING-0} : { *(.gnu.version) }
60  .gnu.version_d	${RELOCATING-0} : { *(.gnu.version_d) }
61  .gnu.version_r	${RELOCATING-0} : { *(.gnu.version_r) }
62
63  .rel.text		${RELOCATING-0} : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
64  .rela.text		${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
65  .rel.data		${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
66  .rela.data		${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
67  .rel.rodata		${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
68  .rela.rodata		${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
69  .rel.stext		${RELOCATING-0} : { *(.rel.stest) }
70  .rela.stext		${RELOCATING-0} : { *(.rela.stest) }
71  .rel.etext		${RELOCATING-0} : { *(.rel.etest) }
72  .rela.etext		${RELOCATING-0} : { *(.rela.etest) }
73  .rel.sdata		${RELOCATING-0} : { *(.rel.sdata) }
74  .rela.sdata		${RELOCATING-0} : { *(.rela.sdata) }
75  .rel.edata		${RELOCATING-0} : { *(.rel.edata) }
76  .rela.edata		${RELOCATING-0} : { *(.rela.edata) }
77  .rel.eit_v		${RELOCATING-0} : { *(.rel.eit_v) }
78  .rela.eit_v		${RELOCATING-0} : { *(.rela.eit_v) }
79  .rel.sbss		${RELOCATING-0} : { *(.rel.sbss) }
80  .rela.sbss		${RELOCATING-0} : { *(.rela.sbss) }
81  .rel.ebss		${RELOCATING-0} : { *(.rel.ebss) }
82  .rela.ebss		${RELOCATING-0} : { *(.rela.ebss) }
83  .rel.srodata		${RELOCATING-0} : { *(.rel.srodata) }
84  .rela.srodata		${RELOCATING-0} : { *(.rela.srodata) }
85  .rel.erodata		${RELOCATING-0} : { *(.rel.erodata) }
86  .rela.erodata		${RELOCATING-0} : { *(.rela.erodata) }
87  .rel.got		${RELOCATING-0} : { *(.rel.got) }
88  .rela.got		${RELOCATING-0} : { *(.rela.got) }
89  .rel.ctors		${RELOCATING-0} : { *(.rel.ctors) }
90  .rela.ctors		${RELOCATING-0} : { *(.rela.ctors) }
91  .rel.dtors		${RELOCATING-0} : { *(.rel.dtors) }
92  .rela.dtors		${RELOCATING-0} : { *(.rela.dtors) }
93  .rel.init		${RELOCATING-0} : { *(.rel.init) }
94  .rela.init		${RELOCATING-0} : { *(.rela.init) }
95  .rel.fini		${RELOCATING-0} : { *(.rel.fini) }
96  .rela.fini		${RELOCATING-0} : { *(.rela.fini) }
97  .rel.bss		${RELOCATING-0} : { *(.rel.bss) }
98  .rela.bss		${RELOCATING-0} : { *(.rela.bss) }
99  .rel.plt		${RELOCATING-0} : { *(.rel.plt) }
100  .rela.plt		${RELOCATING-0} : { *(.rela.plt) }
101
102  .init			${RELOCATING-0} : { *(.init) } =${NOP-0}
103  ${DATA_PLT-${PLT}}
104
105  /* Internal text space */
106  .stext	${RELOCATING-0} : { *(.stext) }		${RELOCATING+ > text}
107
108  /* Internal text space or external memory */
109  .text :
110  {
111    *(.text)
112    *(.gnu.linkonce.t*)
113    *(.init)
114    *(.fini)
115    ${RELOCATING+ _etext = . ; }
116  } ${RELOCATING+ > ${TEXT_MEMORY}}
117
118  /* Internal data space */
119  .srodata	${RELOCATING-0} : { *(.srodata) }	${RELOCATING+ > data}
120  .sdata	${RELOCATING-0} : { *(.sdata) }		${RELOCATING+ > data}
121
122  /* Internal data space or external memory */
123  .rodata	${RELOCATING-0} : { *(.rodata) }	${RELOCATING+ > ${DATA_MEMORY}}
124
125  /* C++ exception support.  */
126  .eh_frame	${RELOCATING-0} : { KEEP (*(.eh_frame)) }	${RELOCATING+ > ${DATA_MEMORY}}
127  .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) }	${RELOCATING+ > ${DATA_MEMORY}}
128
129  /* Java class registration support.  */
130  .jcr		${RELOCATING-0} : { KEEP (*(.jcr)) }	${RELOCATING+ >${DATA_MEMORY}}
131
132  ${RELOCATING+${CTOR}}
133  ${RELOCATING+${DTOR}}
134
135  .data		${RELOCATING-0} :
136  {
137    *(.data)
138    *(.gnu.linkonce.d*)
139    ${CONSTRUCTING+CONSTRUCTORS}
140    ${RELOCATING+ _edata = . ; }
141  } ${RELOCATING+ > ${DATA_MEMORY}}
142
143  /* External memory */
144  .etext	${RELOCATING-0} :
145  {
146    ${RELOCATING+ PROVIDE (__etext_start = .) ; }
147    *(.etext)
148    ${RELOCATING+ PROVIDE (__etext_end = .) ; }
149  } ${RELOCATING+ > emem}
150
151  .erodata	${RELOCATING-0} : { *(.erodata) }	${RELOCATING+ > emem}
152  .edata	${RELOCATING-0} : { *(.edata) }		${RELOCATING+ > emem}
153
154  .sbss		${RELOCATING-0} :
155  {
156    ${RELOCATING+ PROVIDE (__sbss_start = .) ; }
157    *(.sbss)
158    ${RELOCATING+ PROVIDE (__sbss_end = .) ;  }
159  } ${RELOCATING+ > data}
160
161  .ebss		${RELOCATING-0} :
162  {
163    ${RELOCATING+ PROVIDE (__ebss_start = .) ; }
164    *(.ebss)
165    ${RELOCATING+ PROVIDE (__ebss_end = .) ;  }
166  } ${RELOCATING+ > data}
167
168  .bss		${RELOCATING-0} :
169  {
170    ${RELOCATING+ PROVIDE (__bss_start = .) ; }
171    *(.bss)
172    *(COMMON)
173    ${RELOCATING+ PROVIDE (__bss_end = .) ; }
174    ${RELOCATING+ _end = . ;  }
175  } ${RELOCATING+ > ${DATA_MEMORY}}
176
177  .eit_v	${RELOCATING-0} :
178  {
179    ${RELOCATING+ PROVIDE (__eit_start = .) ; }
180    *(.eit_v)
181    ${RELOCATING+ PROVIDE (__eit_end = .) ; }
182  } ${RELOCATING+ > eit}
183
184  /* Stabs debugging sections.  */
185  .stab		 0 : { *(.stab) }
186  .stabstr	 0 : { *(.stabstr) }
187  .stab.excl	 0 : { *(.stab.excl) }
188  .stab.exclstr	 0 : { *(.stab.exclstr) }
189  .stab.index	 0 : { *(.stab.index) }
190  .stab.indexstr 0 : { *(.stab.indexstr) }
191
192  .comment	 0 : { *(.comment) }
193
194  /* DWARF debug sections.
195     Symbols in the DWARF debugging sections are relative to the beginning
196     of the section so we begin them at 0.  */
197
198  /* DWARF 1 */
199  .debug	 0 : { *(.debug) }
200  .line		 0 : { *(.line) }
201
202  /* GNU DWARF 1 extensions */
203  .debug_srcinfo 0 : { *(.debug_srcinfo) }
204  .debug_sfnames 0 : { *(.debug_sfnames) }
205
206  /* DWARF 1.1 and DWARF 2 */
207  .debug_aranges  0 : { *(.debug_aranges) }
208  .debug_pubnames 0 : { *(.debug_pubnames) }
209
210  /* DWARF 2 */
211  .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
212  .debug_abbrev   0 : { *(.debug_abbrev) }
213  .debug_line     0 : { *(.debug_line) }
214  .debug_frame    0 : { *(.debug_frame) }
215  .debug_str      0 : { *(.debug_str) }
216  .debug_loc      0 : { *(.debug_loc) }
217  .debug_macinfo  0 : { *(.debug_macinfo) }
218
219  PROVIDE (__stack = ${STACK_START_ADDR});
220}
221EOF
222
223
224
225
226