2 OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
7 test -n "${RELOCATING}" && cat <<EOF
8 /* Allow memory sizes to be overridden from command line. */
9 __IMEM_SIZE = DEFINED(__IMEM_SIZE) ? __IMEM_SIZE : $TEXT_LENGTH;
10 __DMEM_SIZE = DEFINED(__DMEM_SIZE) ? __DMEM_SIZE : $DATA_LENGTH;
14 imem (x) : ORIGIN = $TEXT_ORIGIN, LENGTH = __IMEM_SIZE
15 dmem (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DMEM_SIZE
18 __HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32;
19 __STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 512;
21 PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem));
30 /* Read-only sections, merged into text segment: */
31 ${TEXT_DYNAMIC+${DYNAMIC}}
32 .hash ${RELOCATING-0} : { *(.hash) }
33 .dynsym ${RELOCATING-0} : { *(.dynsym) }
34 .dynstr ${RELOCATING-0} : { *(.dynstr) }
35 .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
36 .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
37 .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
39 .rel.init ${RELOCATING-0} : { *(.rel.init) }
40 .rela.init ${RELOCATING-0} : { *(.rela.init) }
41 .rel.text ${RELOCATING-0} :
44 ${RELOCATING+*(.rel.text.*)}
45 ${RELOCATING+*(.rel.text:*)}
46 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
48 .rela.text ${RELOCATING-0} :
51 ${RELOCATING+*(.rela.text.*)}
52 ${RELOCATING+*(.rela.text:*)}
53 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
55 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
56 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
57 .rel.rodata ${RELOCATING-0} :
60 ${RELOCATING+*(.rel.rodata.*)}
61 ${RELOCATING+*(.rel.rodata:*)}
62 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
64 .rela.rodata ${RELOCATING-0} :
67 ${RELOCATING+*(.rela.rodata.*)}
68 ${RELOCATING+*(.rela.rodata:*)}
69 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
71 .rel.data ${RELOCATING-0} :
74 ${RELOCATING+*(.rel.data.*)}
75 ${RELOCATING+*(.rel.data:*)}
76 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
78 .rela.data ${RELOCATING-0} :
81 ${RELOCATING+*(.rela.data.*)}
82 ${RELOCATING+*(.rela.data:*)}
83 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
85 .rel.init_array ${RELOCATING-0} : { *(.rel.init_array) }
86 .rela.init_array ${RELOCATING-0} : { *(.rela.init_array) }
87 .rel.fini_array ${RELOCATING-0} : { *(.rel.fini_array) }
88 .rela.fini_array ${RELOCATING-0} : { *(.rela.fini_array) }
89 .rel.got ${RELOCATING-0} : { *(.rel.got) }
90 .rela.got ${RELOCATING-0} : { *(.rela.got) }
91 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
92 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
93 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
94 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
96 /* Internal text space. */
97 .text ${RELOCATING-0} :
99 ${RELOCATING+ _text_start = . ; }
101 ${RELOCATING+. = ALIGN(4);}
103 ${RELOCATING+*(.init0) /* Start here after reset. */}
104 ${RELOCATING+KEEP (*(.init0))}
106 ${RELOCATING+. = ALIGN(4);}
108 ${RELOCATING+. = ALIGN(4);}
109 ${RELOCATING+*(.text.*)}
110 ${RELOCATING+. = ALIGN(4);}
111 ${RELOCATING+*(.text:*)}
112 ${RELOCATING+. = ALIGN(4);}
113 ${RELOCATING+*(.gnu.linkonce.t*)}
114 ${RELOCATING+. = ALIGN(4);}
116 ${RELOCATING+ _text_end = . ; }
117 } ${RELOCATING+ > imem}
119 .data ${RELOCATING-0} :
121 /* Optional variable that user is prepared to have NULL address. */
122 ${RELOCATING+ *(.data.atzero*)}
124 /* CRT is prepared for constructor/destructor table to have
125 a "valid" NULL address. */
126 ${CONSTRUCTING+ __init_array_start = . ; }
127 ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))}
128 ${CONSTRUCTING+ KEEP (*(.init_array))}
129 ${CONSTRUCTING+ __init_array_end = . ; }
130 ${CONSTRUCTING+ __fini_array_start = . ; }
131 ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))}
132 ${CONSTRUCTING+ KEEP (*(.fini_array))}
133 ${CONSTRUCTING+ __fini_array_end = . ; }
135 ${RELOCATING+/* DATA memory starts at address 0. So to avoid placing a valid static
136 variable at the invalid NULL address, we introduce the .data.atzero
137 section. If CRT can make some use of it - great. Otherwise skip a
138 word. In all cases .data/.bss sections must start at non-zero. */
139 . += (. == 0 ? 4 : 0);}
141 ${RELOCATING+ PROVIDE (_data_start = .) ; }
143 ${RELOCATING+ *(.data*)}
144 ${RELOCATING+ *(.data:*)}
145 ${RELOCATING+ *(.rodata) /* We need to include .rodata here if gcc is used. */}
146 ${RELOCATING+ *(.rodata.*) /* with -fdata-sections. */}
147 ${RELOCATING+ *(.rodata:*)}
148 ${RELOCATING+*(.gnu.linkonce.d*)}
149 ${RELOCATING+*(.gnu.linkonce.r*)}
150 ${RELOCATING+. = ALIGN(4);}
151 ${RELOCATING+ PROVIDE (_data_end = .) ; }
152 } ${RELOCATING+ > dmem }
154 /* Linux remoteproc loader requires the resource_table section
155 start address to be aligned to 8 bytes. */
156 .resource_table ${RELOCATING-0} ${RELOCATING+ ALIGN(8)} :
158 KEEP (*(.resource_table))
159 } ${RELOCATING+ > dmem}
161 .bss ${RELOCATING-0} :
163 ${RELOCATING+ PROVIDE (_bss_start = .) ; }
165 ${RELOCATING+ *(.bss.*)}
166 ${RELOCATING+ *(.bss:*)}
167 ${RELOCATING+*(.gnu.linkonce.b*)}
168 ${RELOCATING+*(COMMON)}
169 ${RELOCATING+ PROVIDE (_bss_end = .) ; }
170 } ${RELOCATING+ > dmem}
172 /* Global data not cleared after reset. */
173 .noinit ${RELOCATING-0} :
175 ${RELOCATING+ PROVIDE (_noinit_start = .) ; }
176 *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
177 ${RELOCATING+ PROVIDE (_noinit_end = .) ; }
178 ${RELOCATING+ PROVIDE (_heap_start = .) ; }
179 ${RELOCATING+ . += __HEAP_SIZE ; }
180 ${RELOCATING+/* Stack is not here really. It will be put at the end of DMEM.
181 But we take into account its size here, in order to allow
182 for MEMORY overflow checking during link time. */}
183 ${RELOCATING+ . += __STACK_SIZE ; }
184 } ${RELOCATING+ > dmem}
186 /* Remoteproc loader in Linux kernel 5.10 and later reads this section
187 to setup the PRUSS interrupt controller. The interrupt map section
188 is never referenced from PRU firmware, so there is no need to
189 place it in the target dmem memory. */
190 .pru_irq_map 0 : { *(.pru_irq_map) }
192 /* Stabs debugging sections. */
193 .stab 0 : { *(.stab) }
194 .stabstr 0 : { *(.stabstr) }
195 .stab.excl 0 : { *(.stab.excl) }
196 .stab.exclstr 0 : { *(.stab.exclstr) }
197 .stab.index 0 : { *(.stab.index) }
198 .stab.indexstr 0 : { *(.stab.indexstr) }
199 .comment 0 : { *(.comment) }
200 .note.gnu.build-id ${RELOCATING-0} : { *(.note.gnu.build-id) }
203 . $srcdir/scripttempl/DWARF.sc