]>
Commit | Line | Data |
---|---|---|
d87bef3a | 1 | # Copyright (C) 2014-2023 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 | |
d87bef3a | 46 | /* Copyright (C) 2014-2023 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 | ||
2bf2bf23 AM |
55 | EOF |
56 | ||
57 | test -n "${RELOCATING}" && cat <<EOF | |
252b5132 RH |
58 | MEMORY |
59 | { | |
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} | |
64 | } | |
65 | ||
2bf2bf23 AM |
66 | EOF |
67 | ||
68 | cat <<EOF | |
252b5132 RH |
69 | SECTIONS |
70 | { | |
71 | /* Read-only sections, merged into text segment: */ | |
72 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
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) } | |
79 | ||
2bf2bf23 AM |
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*}) } | |
ec2d9b29 AM |
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) } | |
118 | ||
2d3181c7 | 119 | .init ${RELOCATING-0} : { KEEP (*(SORT_NONE(.init))) } =${NOP-0} |
252b5132 RH |
120 | ${DATA_PLT-${PLT}} |
121 | ||
122 | /* Internal text space */ | |
ec2d9b29 | 123 | .stext ${RELOCATING-0} : { *(.stext) } ${RELOCATING+ > text} |
252b5132 RH |
124 | |
125 | /* Internal text space or external memory */ | |
126 | .text : | |
127 | { | |
128 | *(.text) | |
2bf2bf23 | 129 | ${RELOCATING+*(.gnu.linkonce.t*) |
2d3181c7 | 130 | KEEP (*(SORT_NONE(.fini))) |
2bf2bf23 | 131 | _etext = . ;} |
252b5132 RH |
132 | } ${RELOCATING+ > ${TEXT_MEMORY}} |
133 | ||
134 | /* Internal data space */ | |
ec2d9b29 AM |
135 | .srodata ${RELOCATING-0} : { *(.srodata) } ${RELOCATING+ > data} |
136 | .sdata ${RELOCATING-0} : { *(.sdata) } ${RELOCATING+ > data} | |
252b5132 RH |
137 | |
138 | /* Internal data space or external memory */ | |
ec2d9b29 | 139 | .rodata ${RELOCATING-0} : { *(.rodata) } ${RELOCATING+ > ${DATA_MEMORY}} |
252b5132 RH |
140 | |
141 | /* C++ exception support. */ | |
ec2d9b29 AM |
142 | .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } ${RELOCATING+ > ${DATA_MEMORY}} |
143 | .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > ${DATA_MEMORY}} | |
252b5132 | 144 | |
24098abb | 145 | /* Java class registration support. */ |
ec2d9b29 | 146 | .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } ${RELOCATING+ >${DATA_MEMORY}} |
24098abb | 147 | |
252b5132 RH |
148 | ${RELOCATING+${CTOR}} |
149 | ${RELOCATING+${DTOR}} | |
150 | ||
ec2d9b29 | 151 | .data ${RELOCATING-0} : |
252b5132 RH |
152 | { |
153 | *(.data) | |
2bf2bf23 | 154 | ${RELOCATING+*(.gnu.linkonce.d*)} |
252b5132 RH |
155 | ${CONSTRUCTING+CONSTRUCTORS} |
156 | ${RELOCATING+ _edata = . ; } | |
157 | } ${RELOCATING+ > ${DATA_MEMORY}} | |
158 | ||
159 | /* External memory */ | |
ec2d9b29 | 160 | .etext ${RELOCATING-0} : |
252b5132 RH |
161 | { |
162 | ${RELOCATING+ PROVIDE (__etext_start = .) ; } | |
163 | *(.etext) | |
164 | ${RELOCATING+ PROVIDE (__etext_end = .) ; } | |
165 | } ${RELOCATING+ > emem} | |
166 | ||
ec2d9b29 AM |
167 | .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem} |
168 | .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem} | |
252b5132 | 169 | |
ec2d9b29 | 170 | .sbss ${RELOCATING-0} : |
252b5132 RH |
171 | { |
172 | ${RELOCATING+ PROVIDE (__sbss_start = .) ; } | |
173 | *(.sbss) | |
174 | ${RELOCATING+ PROVIDE (__sbss_end = .) ; } | |
175 | } ${RELOCATING+ > data} | |
176 | ||
ec2d9b29 | 177 | .ebss ${RELOCATING-0} : |
252b5132 RH |
178 | { |
179 | ${RELOCATING+ PROVIDE (__ebss_start = .) ; } | |
180 | *(.ebss) | |
181 | ${RELOCATING+ PROVIDE (__ebss_end = .) ; } | |
182 | } ${RELOCATING+ > data} | |
183 | ||
ec2d9b29 | 184 | .bss ${RELOCATING-0} : |
252b5132 RH |
185 | { |
186 | ${RELOCATING+ PROVIDE (__bss_start = .) ; } | |
187 | *(.bss) | |
2bf2bf23 | 188 | ${RELOCATING+*(COMMON)} |
252b5132 RH |
189 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } |
190 | ${RELOCATING+ _end = . ; } | |
191 | } ${RELOCATING+ > ${DATA_MEMORY}} | |
192 | ||
ec2d9b29 | 193 | .eit_v ${RELOCATING-0} : |
252b5132 RH |
194 | { |
195 | ${RELOCATING+ PROVIDE (__eit_start = .) ; } | |
196 | *(.eit_v) | |
197 | ${RELOCATING+ PROVIDE (__eit_end = .) ; } | |
198 | } ${RELOCATING+ > eit} | |
199 | ||
ceb0a680 NC |
200 | EOF |
201 | ||
2d5783fa | 202 | . $srcdir/scripttempl/misc-sections.sc |
d061dfac | 203 | . $srcdir/scripttempl/DWARF.sc |
ceb0a680 | 204 | |
6c19b93b | 205 | cat <<EOF |
2bf2bf23 | 206 | ${RELOCATING+PROVIDE (__stack = ${STACK_START_ADDR});} |
252b5132 RH |
207 | } |
208 | EOF | |
209 | ||
210 | ||
211 |