1 # Copyright (C) 2014-2018 Free Software Foundation, Inc.
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.
7 CTOR=".ctors ${CONSTRUCTING-0} :
9 ${CONSTRUCTING+ __CTOR_LIST__ = .; }
10 /* gcc uses crtbegin.o to find the start of
11 the constructors, so we make sure it is
12 first. Because this is a wildcard, it
13 doesn't matter if the user does not
14 actually link against crtbegin.o; the
15 linker won't look for a file to match a
16 wildcard. The wildcard also means that it
17 doesn't matter which directory crtbegin.o
20 KEEP (*crtbegin.o(.ctors))
21 KEEP (*crtbegin?.o(.ctors))
23 /* We don't want to include the .ctor section from
24 the crtend.o file until after the sorted ctors.
25 The .ctor section from the crtend file contains the
26 end of ctors marker and it must be last */
28 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
29 KEEP (*(SORT(.ctors.*)))
31 ${CONSTRUCTING+ __CTOR_END__ = .; }
32 } ${RELOCATING+ > ${DATA_MEMORY}}"
34 DTOR=" .dtors ${CONSTRUCTING-0} :
36 ${CONSTRUCTING+ __DTOR_LIST__ = .; }
37 KEEP (*crtbegin.o(.dtors))
38 KEEP (*crtbegin?.o(.dtors))
39 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
40 KEEP (*(SORT(.dtors.*)))
42 ${CONSTRUCTING+ __DTOR_END__ = .; }
43 } ${RELOCATING+ > ${DATA_MEMORY}}"
46 /* Copyright (C) 2014-2018 Free Software Foundation, Inc.
48 Copying and distribution of this script, with or without modification,
49 are permitted in any medium without royalty provided the copyright
50 notice and this notice are preserved. */
52 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
57 test -n "${RELOCATING}" && cat <<EOF
60 text ${TEXT_DEF_SECTION} : ORIGIN = ${TEXT_START_ADDR}, LENGTH = ${TEXT_SIZE}
61 data ${DATA_DEF_SECTION} : ORIGIN = ${DATA_START_ADDR}, LENGTH = ${DATA_SIZE}
62 emem ${EMEM_DEF_SECTION} : ORIGIN = ${EMEM_START_ADDR}, LENGTH = ${EMEM_SIZE}
63 eit : ORIGIN = ${EIT_START_ADDR}, LENGTH = ${EIT_SIZE}
71 /* Read-only sections, merged into text segment: */
72 ${TEXT_DYNAMIC+${DYNAMIC}}
73 .hash ${RELOCATING-0} : { *(.hash) }
74 .dynsym ${RELOCATING-0} : { *(.dynsym) }
75 .dynstr ${RELOCATING-0} : { *(.dynstr) }
76 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
77 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
78 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
80 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.gnu.linkonce.t*}) }
81 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.gnu.linkonce.t*}) }
82 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.gnu.linkonce.d*}) }
83 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.gnu.linkonce.d*}) }
84 .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.gnu.linkonce.r*}) }
85 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.gnu.linkonce.r*}) }
86 .rel.stext ${RELOCATING-0} : { *(.rel.stest) }
87 .rela.stext ${RELOCATING-0} : { *(.rela.stest) }
88 .rel.etext ${RELOCATING-0} : { *(.rel.etest) }
89 .rela.etext ${RELOCATING-0} : { *(.rela.etest) }
90 .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) }
91 .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
92 .rel.edata ${RELOCATING-0} : { *(.rel.edata) }
93 .rela.edata ${RELOCATING-0} : { *(.rela.edata) }
94 .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) }
95 .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) }
96 .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) }
97 .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
98 .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) }
99 .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) }
100 .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) }
101 .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) }
102 .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) }
103 .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) }
104 .rel.got ${RELOCATING-0} : { *(.rel.got) }
105 .rela.got ${RELOCATING-0} : { *(.rela.got) }
106 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
107 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
108 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
109 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
110 .rel.init ${RELOCATING-0} : { *(.rel.init) }
111 .rela.init ${RELOCATING-0} : { *(.rela.init) }
112 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
113 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
114 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
115 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
116 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
117 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
119 .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
122 /* Internal text space */
123 .stext ${RELOCATING-0} : { *(.stext) } ${RELOCATING+ > text}
125 /* Internal text space or external memory */
129 ${RELOCATING+*(.gnu.linkonce.t*)
133 } ${RELOCATING+ > ${TEXT_MEMORY}}
135 /* Internal data space */
136 .srodata ${RELOCATING-0} : { *(.srodata) } ${RELOCATING+ > data}
137 .sdata ${RELOCATING-0} : { *(.sdata) } ${RELOCATING+ > data}
139 /* Internal data space or external memory */
140 .rodata ${RELOCATING-0} : { *(.rodata) } ${RELOCATING+ > ${DATA_MEMORY}}
142 /* C++ exception support. */
143 .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } ${RELOCATING+ > ${DATA_MEMORY}}
144 .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > ${DATA_MEMORY}}
146 /* Java class registration support. */
147 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } ${RELOCATING+ >${DATA_MEMORY}}
149 ${RELOCATING+${CTOR}}
150 ${RELOCATING+${DTOR}}
152 .data ${RELOCATING-0} :
155 ${RELOCATING+*(.gnu.linkonce.d*)}
156 ${CONSTRUCTING+CONSTRUCTORS}
157 ${RELOCATING+ _edata = . ; }
158 } ${RELOCATING+ > ${DATA_MEMORY}}
160 /* External memory */
161 .etext ${RELOCATING-0} :
163 ${RELOCATING+ PROVIDE (__etext_start = .) ; }
165 ${RELOCATING+ PROVIDE (__etext_end = .) ; }
166 } ${RELOCATING+ > emem}
168 .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem}
169 .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem}
171 .sbss ${RELOCATING-0} :
173 ${RELOCATING+ PROVIDE (__sbss_start = .) ; }
175 ${RELOCATING+ PROVIDE (__sbss_end = .) ; }
176 } ${RELOCATING+ > data}
178 .ebss ${RELOCATING-0} :
180 ${RELOCATING+ PROVIDE (__ebss_start = .) ; }
182 ${RELOCATING+ PROVIDE (__ebss_end = .) ; }
183 } ${RELOCATING+ > data}
185 .bss ${RELOCATING-0} :
187 ${RELOCATING+ PROVIDE (__bss_start = .) ; }
189 ${RELOCATING+*(COMMON)}
190 ${RELOCATING+ PROVIDE (__bss_end = .) ; }
191 ${RELOCATING+ _end = . ; }
192 } ${RELOCATING+ > ${DATA_MEMORY}}
194 .eit_v ${RELOCATING-0} :
196 ${RELOCATING+ PROVIDE (__eit_start = .) ; }
198 ${RELOCATING+ PROVIDE (__eit_end = .) ; }
199 } ${RELOCATING+ > eit}
201 /* Stabs debugging sections. */
202 .stab 0 : { *(.stab) }
203 .stabstr 0 : { *(.stabstr) }
204 .stab.excl 0 : { *(.stab.excl) }
205 .stab.exclstr 0 : { *(.stab.exclstr) }
206 .stab.index 0 : { *(.stab.index) }
207 .stab.indexstr 0 : { *(.stab.indexstr) }
209 .comment 0 : { *(.comment) }
213 . $srcdir/scripttempl/DWARF.sc
216 ${RELOCATING+PROVIDE (__stack = ${STACK_START_ADDR});}