2 OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
7 test -n "${RELOCATING}" && cat <<EOF
10 imem (x) : ORIGIN = $TEXT_ORIGIN, LENGTH = $TEXT_LENGTH
11 dmem (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
14 __HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32;
15 __STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 512;
17 PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem));
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) }
35 .rel.init ${RELOCATING-0} : { *(.rel.init) }
36 .rela.init ${RELOCATING-0} : { *(.rela.init) }
37 .rel.text ${RELOCATING-0} :
40 ${RELOCATING+*(.rel.text.*)}
41 ${RELOCATING+*(.rel.text:*)}
42 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
44 .rela.text ${RELOCATING-0} :
47 ${RELOCATING+*(.rela.text.*)}
48 ${RELOCATING+*(.rela.text:*)}
49 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
51 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
52 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
53 .rel.rodata ${RELOCATING-0} :
56 ${RELOCATING+*(.rel.rodata.*)}
57 ${RELOCATING+*(.rel.rodata:*)}
58 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
60 .rela.rodata ${RELOCATING-0} :
63 ${RELOCATING+*(.rela.rodata.*)}
64 ${RELOCATING+*(.rela.rodata:*)}
65 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
67 .rel.data ${RELOCATING-0} :
70 ${RELOCATING+*(.rel.data.*)}
71 ${RELOCATING+*(.rel.data:*)}
72 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
74 .rela.data ${RELOCATING-0} :
77 ${RELOCATING+*(.rela.data.*)}
78 ${RELOCATING+*(.rela.data:*)}
79 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
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) }
92 /* Internal text space. */
93 .text ${RELOCATING-0} :
95 ${RELOCATING+ _text_start = . ; }
97 ${RELOCATING+. = ALIGN(4);}
99 ${RELOCATING+*(.init0) /* Start here after reset. */}
100 ${RELOCATING+KEEP (*(.init0))}
102 ${RELOCATING+. = ALIGN(4);}
104 ${RELOCATING+. = ALIGN(4);}
105 ${RELOCATING+*(.text.*)}
106 ${RELOCATING+. = ALIGN(4);}
107 ${RELOCATING+*(.text:*)}
108 ${RELOCATING+. = ALIGN(4);}
109 ${RELOCATING+*(.gnu.linkonce.t*)}
110 ${RELOCATING+. = ALIGN(4);}
112 ${RELOCATING+ _text_end = . ; }
113 } ${RELOCATING+ > imem}
115 .data ${RELOCATING-0} :
117 /* Optional variable that user is prepared to have NULL address. */
118 ${RELOCATING+ *(.data.atzero*)}
120 /* CRT is prepared for constructor/destructor table to have
121 a "valid" NULL address. */
122 ${CONSTRUCTING+ __init_array_start = . ; }
123 ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))}
124 ${CONSTRUCTING+ KEEP (*(.init_array))}
125 ${CONSTRUCTING+ __init_array_end = . ; }
126 ${CONSTRUCTING+ __fini_array_start = . ; }
127 ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))}
128 ${CONSTRUCTING+ KEEP (*(.fini_array))}
129 ${CONSTRUCTING+ __fini_array_end = . ; }
131 ${RELOCATING+/* DATA memory starts at address 0. So to avoid placing a valid static
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. */
135 . += (. == 0 ? 4 : 0);}
137 ${RELOCATING+ PROVIDE (_data_start = .) ; }
139 ${RELOCATING+ *(.data*)}
140 ${RELOCATING+ *(.data:*)}
141 ${RELOCATING+ *(.rodata) /* We need to include .rodata here if gcc is used. */}
142 ${RELOCATING+ *(.rodata.*) /* with -fdata-sections. */}
143 ${RELOCATING+ *(.rodata:*)}
144 ${RELOCATING+*(.gnu.linkonce.d*)}
145 ${RELOCATING+*(.gnu.linkonce.r*)}
146 ${RELOCATING+. = ALIGN(4);}
147 ${RELOCATING+ PROVIDE (_data_end = .) ; }
148 } ${RELOCATING+ > dmem }
150 .resource_table ${RELOCATING-0} :
152 KEEP (*(.resource_table))
153 } ${RELOCATING+ > dmem}
155 .bss ${RELOCATING-0} :
157 ${RELOCATING+ PROVIDE (_bss_start = .) ; }
159 ${RELOCATING+ *(.bss.*)}
160 ${RELOCATING+ *(.bss:*)}
161 ${RELOCATING+*(.gnu.linkonce.b*)}
162 ${RELOCATING+*(COMMON)}
163 ${RELOCATING+ PROVIDE (_bss_end = .) ; }
164 } ${RELOCATING+ > dmem}
166 /* Global data not cleared after reset. */
167 .noinit ${RELOCATING-0} :
169 ${RELOCATING+ PROVIDE (_noinit_start = .) ; }
171 ${RELOCATING+ PROVIDE (_noinit_end = .) ; }
172 ${RELOCATING+ PROVIDE (_heap_start = .) ; }
173 ${RELOCATING+ . += __HEAP_SIZE ; }
174 ${RELOCATING+/* Stack is not here really. It will be put at the end of DMEM.
175 But we take into account its size here, in order to allow
176 for MEMORY overflow checking during link time. */}
177 ${RELOCATING+ . += __STACK_SIZE ; }
178 } ${RELOCATING+ > dmem}
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) }
188 .note.gnu.build-id ${RELOCATING-0} : { *(.note.gnu.build-id) }
191 . $srcdir/scripttempl/DWARF.sc