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