Commit | Line | Data |
---|---|---|
219d1afa | 1 | # Copyright (C) 2014-2018 Free Software Foundation, Inc. |
6c19b93b | 2 | # |
985743c7 NC |
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. | |
252b5132 | 6 | |
6c19b93b | 7 | CTOR=".ctors ${CONSTRUCTING-0} : |
252b5132 RH |
8 | { |
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 | |
18 | is in. */ | |
19 | ||
40cf2291 AM |
20 | KEEP (*crtbegin.o(.ctors)) |
21 | KEEP (*crtbegin?.o(.ctors)) | |
252b5132 RH |
22 | |
23 | /* We don't want to include the .ctor section from | |
bd6791bc | 24 | the crtend.o file until after the sorted ctors. |
252b5132 RH |
25 | The .ctor section from the crtend file contains the |
26 | end of ctors marker and it must be last */ | |
27 | ||
40cf2291 | 28 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors)) |
252b5132 RH |
29 | KEEP (*(SORT(.ctors.*))) |
30 | KEEP (*(.ctors)) | |
31 | ${CONSTRUCTING+ __CTOR_END__ = .; } | |
32 | } ${RELOCATING+ > ${DATA_MEMORY}}" | |
33 | ||
ec2d9b29 | 34 | DTOR=" .dtors ${CONSTRUCTING-0} : |
252b5132 RH |
35 | { |
36 | ${CONSTRUCTING+ __DTOR_LIST__ = .; } | |
40cf2291 AM |
37 | KEEP (*crtbegin.o(.dtors)) |
38 | KEEP (*crtbegin?.o(.dtors)) | |
39 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors)) | |
252b5132 RH |
40 | KEEP (*(SORT(.dtors.*))) |
41 | KEEP (*(.dtors)) | |
42 | ${CONSTRUCTING+ __DTOR_END__ = .; } | |
43 | } ${RELOCATING+ > ${DATA_MEMORY}}" | |
44 | ||
45 | cat <<EOF | |
219d1afa | 46 | /* Copyright (C) 2014-2018 Free Software Foundation, Inc. |
985743c7 NC |
47 | |
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. */ | |
51 | ||
252b5132 RH |
52 | OUTPUT_FORMAT("${OUTPUT_FORMAT}") |
53 | OUTPUT_ARCH(${ARCH}) | |
54 | ||
55 | MEMORY | |
56 | { | |
57 | text ${TEXT_DEF_SECTION} : ORIGIN = ${TEXT_START_ADDR}, LENGTH = ${TEXT_SIZE} | |
58 | data ${DATA_DEF_SECTION} : ORIGIN = ${DATA_START_ADDR}, LENGTH = ${DATA_SIZE} | |
59 | emem ${EMEM_DEF_SECTION} : ORIGIN = ${EMEM_START_ADDR}, LENGTH = ${EMEM_SIZE} | |
60 | eit : ORIGIN = ${EIT_START_ADDR}, LENGTH = ${EIT_SIZE} | |
61 | } | |
62 | ||
63 | SECTIONS | |
64 | { | |
65 | /* Read-only sections, merged into text segment: */ | |
66 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
67 | .hash ${RELOCATING-0} : { *(.hash) } |
68 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
69 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
70 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
71 | .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } | |
72 | .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } | |
73 | ||
74 | .rel.text ${RELOCATING-0} : { *(.rel.text) *(.rel.gnu.linkonce.t*) } | |
75 | .rela.text ${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) } | |
76 | .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) } | |
77 | .rela.data ${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) } | |
78 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } | |
79 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } | |
80 | .rel.stext ${RELOCATING-0} : { *(.rel.stest) } | |
81 | .rela.stext ${RELOCATING-0} : { *(.rela.stest) } | |
82 | .rel.etext ${RELOCATING-0} : { *(.rel.etest) } | |
83 | .rela.etext ${RELOCATING-0} : { *(.rela.etest) } | |
84 | .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } | |
85 | .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } | |
86 | .rel.edata ${RELOCATING-0} : { *(.rel.edata) } | |
87 | .rela.edata ${RELOCATING-0} : { *(.rela.edata) } | |
88 | .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } | |
89 | .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) } | |
90 | .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) } | |
91 | .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } | |
92 | .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) } | |
93 | .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } | |
94 | .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) } | |
95 | .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } | |
96 | .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) } | |
97 | .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } | |
98 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
99 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
100 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
101 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
102 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
103 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
104 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
105 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
106 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
107 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
108 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
109 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
110 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
111 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
112 | ||
113 | .init ${RELOCATING-0} : { *(.init) } =${NOP-0} | |
252b5132 RH |
114 | ${DATA_PLT-${PLT}} |
115 | ||
116 | /* Internal text space */ | |
ec2d9b29 | 117 | .stext ${RELOCATING-0} : { *(.stext) } ${RELOCATING+ > text} |
252b5132 RH |
118 | |
119 | /* Internal text space or external memory */ | |
120 | .text : | |
121 | { | |
122 | *(.text) | |
123 | *(.gnu.linkonce.t*) | |
b2e4da5a L |
124 | *(SORT_NONE(.init)) |
125 | *(SORT_NONE(.fini)) | |
252b5132 RH |
126 | ${RELOCATING+ _etext = . ; } |
127 | } ${RELOCATING+ > ${TEXT_MEMORY}} | |
128 | ||
129 | /* Internal data space */ | |
ec2d9b29 AM |
130 | .srodata ${RELOCATING-0} : { *(.srodata) } ${RELOCATING+ > data} |
131 | .sdata ${RELOCATING-0} : { *(.sdata) } ${RELOCATING+ > data} | |
252b5132 RH |
132 | |
133 | /* Internal data space or external memory */ | |
ec2d9b29 | 134 | .rodata ${RELOCATING-0} : { *(.rodata) } ${RELOCATING+ > ${DATA_MEMORY}} |
252b5132 RH |
135 | |
136 | /* C++ exception support. */ | |
ec2d9b29 AM |
137 | .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } ${RELOCATING+ > ${DATA_MEMORY}} |
138 | .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > ${DATA_MEMORY}} | |
252b5132 | 139 | |
24098abb | 140 | /* Java class registration support. */ |
ec2d9b29 | 141 | .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } ${RELOCATING+ >${DATA_MEMORY}} |
24098abb | 142 | |
252b5132 RH |
143 | ${RELOCATING+${CTOR}} |
144 | ${RELOCATING+${DTOR}} | |
145 | ||
ec2d9b29 | 146 | .data ${RELOCATING-0} : |
252b5132 RH |
147 | { |
148 | *(.data) | |
149 | *(.gnu.linkonce.d*) | |
150 | ${CONSTRUCTING+CONSTRUCTORS} | |
151 | ${RELOCATING+ _edata = . ; } | |
152 | } ${RELOCATING+ > ${DATA_MEMORY}} | |
153 | ||
154 | /* External memory */ | |
ec2d9b29 | 155 | .etext ${RELOCATING-0} : |
252b5132 RH |
156 | { |
157 | ${RELOCATING+ PROVIDE (__etext_start = .) ; } | |
158 | *(.etext) | |
159 | ${RELOCATING+ PROVIDE (__etext_end = .) ; } | |
160 | } ${RELOCATING+ > emem} | |
161 | ||
ec2d9b29 AM |
162 | .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem} |
163 | .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem} | |
252b5132 | 164 | |
ec2d9b29 | 165 | .sbss ${RELOCATING-0} : |
252b5132 RH |
166 | { |
167 | ${RELOCATING+ PROVIDE (__sbss_start = .) ; } | |
168 | *(.sbss) | |
169 | ${RELOCATING+ PROVIDE (__sbss_end = .) ; } | |
170 | } ${RELOCATING+ > data} | |
171 | ||
ec2d9b29 | 172 | .ebss ${RELOCATING-0} : |
252b5132 RH |
173 | { |
174 | ${RELOCATING+ PROVIDE (__ebss_start = .) ; } | |
175 | *(.ebss) | |
176 | ${RELOCATING+ PROVIDE (__ebss_end = .) ; } | |
177 | } ${RELOCATING+ > data} | |
178 | ||
ec2d9b29 | 179 | .bss ${RELOCATING-0} : |
252b5132 RH |
180 | { |
181 | ${RELOCATING+ PROVIDE (__bss_start = .) ; } | |
182 | *(.bss) | |
183 | *(COMMON) | |
184 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } | |
185 | ${RELOCATING+ _end = . ; } | |
186 | } ${RELOCATING+ > ${DATA_MEMORY}} | |
187 | ||
ec2d9b29 | 188 | .eit_v ${RELOCATING-0} : |
252b5132 RH |
189 | { |
190 | ${RELOCATING+ PROVIDE (__eit_start = .) ; } | |
191 | *(.eit_v) | |
192 | ${RELOCATING+ PROVIDE (__eit_end = .) ; } | |
193 | } ${RELOCATING+ > eit} | |
194 | ||
195 | /* Stabs debugging sections. */ | |
196 | .stab 0 : { *(.stab) } | |
197 | .stabstr 0 : { *(.stabstr) } | |
198 | .stab.excl 0 : { *(.stab.excl) } | |
199 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
200 | .stab.index 0 : { *(.stab.index) } | |
201 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
202 | ||
203 | .comment 0 : { *(.comment) } | |
204 | ||
ceb0a680 NC |
205 | EOF |
206 | ||
d061dfac | 207 | . $srcdir/scripttempl/DWARF.sc |
ceb0a680 | 208 | |
6c19b93b | 209 | cat <<EOF |
252b5132 RH |
210 | PROVIDE (__stack = ${STACK_START_ADDR}); |
211 | } | |
212 | EOF | |
213 | ||
214 | ||
215 | ||
216 |