Commit | Line | Data |
---|---|---|
0220170b DD |
1 | cat <<EOF |
2 | OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") | |
3 | OUTPUT_ARCH(${ARCH}) | |
4 | ||
2bf2bf23 AM |
5 | EOF |
6 | ||
7 | test -n "${RELOCATING}" && cat <<EOF | |
0220170b DD |
8 | MEMORY |
9 | { | |
10 | imem (x) : ORIGIN = $TEXT_ORIGIN, LENGTH = $TEXT_LENGTH | |
11 | dmem (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH | |
12 | } | |
13 | ||
14 | __HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32; | |
15 | __STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 512; | |
16 | ||
2bf2bf23 AM |
17 | PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem)); |
18 | ||
19 | ENTRY (_start) | |
0220170b | 20 | |
2bf2bf23 | 21 | EOF |
0220170b | 22 | |
2bf2bf23 | 23 | cat <<EOF |
0220170b DD |
24 | SECTIONS |
25 | { | |
26 | /* Read-only sections, merged into text segment: */ | |
27 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
28 | .hash ${RELOCATING-0} : { *(.hash) } | |
29 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
30 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
31 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
32 | .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } | |
33 | .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } | |
34 | ||
35 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
36 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
37 | .rel.text ${RELOCATING-0} : | |
38 | { | |
39 | *(.rel.text) | |
40 | ${RELOCATING+*(.rel.text.*)} | |
493ffac5 | 41 | ${RELOCATING+*(.rel.text:*)} |
0220170b DD |
42 | ${RELOCATING+*(.rel.gnu.linkonce.t*)} |
43 | } | |
44 | .rela.text ${RELOCATING-0} : | |
45 | { | |
46 | *(.rela.text) | |
47 | ${RELOCATING+*(.rela.text.*)} | |
493ffac5 | 48 | ${RELOCATING+*(.rela.text:*)} |
0220170b DD |
49 | ${RELOCATING+*(.rela.gnu.linkonce.t*)} |
50 | } | |
51 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
52 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
53 | .rel.rodata ${RELOCATING-0} : | |
54 | { | |
55 | *(.rel.rodata) | |
56 | ${RELOCATING+*(.rel.rodata.*)} | |
493ffac5 | 57 | ${RELOCATING+*(.rel.rodata:*)} |
0220170b DD |
58 | ${RELOCATING+*(.rel.gnu.linkonce.r*)} |
59 | } | |
60 | .rela.rodata ${RELOCATING-0} : | |
61 | { | |
62 | *(.rela.rodata) | |
63 | ${RELOCATING+*(.rela.rodata.*)} | |
493ffac5 | 64 | ${RELOCATING+*(.rela.rodata:*)} |
0220170b DD |
65 | ${RELOCATING+*(.rela.gnu.linkonce.r*)} |
66 | } | |
67 | .rel.data ${RELOCATING-0} : | |
68 | { | |
69 | *(.rel.data) | |
70 | ${RELOCATING+*(.rel.data.*)} | |
493ffac5 | 71 | ${RELOCATING+*(.rel.data:*)} |
0220170b DD |
72 | ${RELOCATING+*(.rel.gnu.linkonce.d*)} |
73 | } | |
74 | .rela.data ${RELOCATING-0} : | |
75 | { | |
76 | *(.rela.data) | |
77 | ${RELOCATING+*(.rela.data.*)} | |
493ffac5 | 78 | ${RELOCATING+*(.rela.data:*)} |
0220170b DD |
79 | ${RELOCATING+*(.rela.gnu.linkonce.d*)} |
80 | } | |
493ffac5 DD |
81 | .rel.init_array ${RELOCATING-0} : { *(.rel.init_array) } |
82 | .rela.init_array ${RELOCATING-0} : { *(.rela.init_array) } | |
83 | .rel.fini_array ${RELOCATING-0} : { *(.rel.fini_array) } | |
84 | .rela.fini_array ${RELOCATING-0} : { *(.rela.fini_array) } | |
85 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
86 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
87 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
88 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
89 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
90 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
0220170b DD |
91 | |
92 | /* Internal text space. */ | |
93 | .text ${RELOCATING-0} : | |
94 | { | |
95 | ${RELOCATING+ _text_start = . ; } | |
96 | ||
97 | ${RELOCATING+. = ALIGN(4);} | |
98 | ||
99 | ${RELOCATING+*(.init0) /* Start here after reset. */} | |
100 | ${RELOCATING+KEEP (*(.init0))} | |
101 | ||
102 | ${RELOCATING+. = ALIGN(4);} | |
103 | *(.text) | |
104 | ${RELOCATING+. = ALIGN(4);} | |
105 | ${RELOCATING+*(.text.*)} | |
106 | ${RELOCATING+. = ALIGN(4);} | |
493ffac5 DD |
107 | ${RELOCATING+*(.text:*)} |
108 | ${RELOCATING+. = ALIGN(4);} | |
0220170b DD |
109 | ${RELOCATING+*(.gnu.linkonce.t*)} |
110 | ${RELOCATING+. = ALIGN(4);} | |
111 | ||
112 | ${RELOCATING+ _text_end = . ; } | |
113 | } ${RELOCATING+ > imem} | |
114 | ||
115 | .data ${RELOCATING-0} : | |
116 | { | |
117 | /* Optional variable that user is prepared to have NULL address. */ | |
118 | ${RELOCATING+ *(.data.atzero*)} | |
119 | ||
120 | /* CRT is prepared for constructor/destructor table to have | |
121 | a "valid" NULL address. */ | |
dd318999 | 122 | ${CONSTRUCTING+ __init_array_start = . ; } |
493ffac5 DD |
123 | ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))} |
124 | ${CONSTRUCTING+ KEEP (*(.init_array))} | |
125 | ${CONSTRUCTING+ __init_array_end = . ; } | |
dd318999 | 126 | ${CONSTRUCTING+ __fini_array_start = . ; } |
493ffac5 DD |
127 | ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))} |
128 | ${CONSTRUCTING+ KEEP (*(.fini_array))} | |
129 | ${CONSTRUCTING+ __fini_array_end = . ; } | |
0220170b | 130 | |
2bf2bf23 | 131 | ${RELOCATING+/* DATA memory starts at address 0. So to avoid placing a valid static |
0220170b DD |
132 | variable at the invalid NULL address, we introduce the .data.atzero |
133 | section. If CRT can make some use of it - great. Otherwise skip a | |
134 | word. In all cases .data/.bss sections must start at non-zero. */ | |
2bf2bf23 | 135 | . += (. == 0 ? 4 : 0);} |
0220170b DD |
136 | |
137 | ${RELOCATING+ PROVIDE (_data_start = .) ; } | |
138 | *(.data) | |
139 | ${RELOCATING+ *(.data*)} | |
493ffac5 | 140 | ${RELOCATING+ *(.data:*)} |
0220170b DD |
141 | ${RELOCATING+ *(.rodata) /* We need to include .rodata here if gcc is used. */} |
142 | ${RELOCATING+ *(.rodata.*) /* with -fdata-sections. */} | |
493ffac5 | 143 | ${RELOCATING+ *(.rodata:*)} |
0220170b DD |
144 | ${RELOCATING+*(.gnu.linkonce.d*)} |
145 | ${RELOCATING+*(.gnu.linkonce.r*)} | |
146 | ${RELOCATING+. = ALIGN(4);} | |
147 | ${RELOCATING+ PROVIDE (_data_end = .) ; } | |
148 | } ${RELOCATING+ > dmem } | |
149 | ||
150 | .resource_table ${RELOCATING-0} : | |
151 | { | |
0220170b | 152 | KEEP (*(.resource_table)) |
2bf2bf23 | 153 | } ${RELOCATING+ > dmem} |
0220170b DD |
154 | |
155 | .bss ${RELOCATING-0} : | |
156 | { | |
157 | ${RELOCATING+ PROVIDE (_bss_start = .) ; } | |
158 | *(.bss) | |
159 | ${RELOCATING+ *(.bss.*)} | |
493ffac5 | 160 | ${RELOCATING+ *(.bss:*)} |
0220170b | 161 | ${RELOCATING+*(.gnu.linkonce.b*)} |
2bf2bf23 | 162 | ${RELOCATING+*(COMMON)} |
0220170b DD |
163 | ${RELOCATING+ PROVIDE (_bss_end = .) ; } |
164 | } ${RELOCATING+ > dmem} | |
165 | ||
166 | /* Global data not cleared after reset. */ | |
c2e86386 | 167 | .noinit ${RELOCATING-0} : |
0220170b DD |
168 | { |
169 | ${RELOCATING+ PROVIDE (_noinit_start = .) ; } | |
170 | *(.noinit) | |
171 | ${RELOCATING+ PROVIDE (_noinit_end = .) ; } | |
172 | ${RELOCATING+ PROVIDE (_heap_start = .) ; } | |
173 | ${RELOCATING+ . += __HEAP_SIZE ; } | |
2bf2bf23 | 174 | ${RELOCATING+/* Stack is not here really. It will be put at the end of DMEM. |
0220170b | 175 | But we take into account its size here, in order to allow |
2bf2bf23 | 176 | for MEMORY overflow checking during link time. */} |
0220170b DD |
177 | ${RELOCATING+ . += __STACK_SIZE ; } |
178 | } ${RELOCATING+ > dmem} | |
179 | ||
180 | /* Stabs debugging sections. */ | |
181 | .stab 0 : { *(.stab) } | |
182 | .stabstr 0 : { *(.stabstr) } | |
183 | .stab.excl 0 : { *(.stab.excl) } | |
184 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
185 | .stab.index 0 : { *(.stab.index) } | |
186 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
187 | .comment 0 : { *(.comment) } | |
c2e86386 | 188 | .note.gnu.build-id ${RELOCATING-0} : { *(.note.gnu.build-id) } |
0220170b DD |
189 | EOF |
190 | ||
191 | . $srcdir/scripttempl/DWARF.sc | |
192 | ||
193 | cat <<EOF | |
194 | } | |
195 | EOF |