Fix binary compatibility between GCC and the TI compiler for the PRU target.
[deliverable/binutils-gdb.git] / ld / scripttempl / pru.sc
CommitLineData
0220170b
DD
1cat <<EOF
2OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
3OUTPUT_ARCH(${ARCH})
4
5MEMORY
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
18SECTIONS
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.*)}
493ffac5 35 ${RELOCATING+*(.rel.text:*)}
0220170b
DD
36 ${RELOCATING+*(.rel.gnu.linkonce.t*)}
37 }
38 .rela.text ${RELOCATING-0} :
39 {
40 *(.rela.text)
41 ${RELOCATING+*(.rela.text.*)}
493ffac5 42 ${RELOCATING+*(.rela.text:*)}
0220170b
DD
43 ${RELOCATING+*(.rela.gnu.linkonce.t*)}
44 }
45 .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
46 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
47 .rel.rodata ${RELOCATING-0} :
48 {
49 *(.rel.rodata)
50 ${RELOCATING+*(.rel.rodata.*)}
493ffac5 51 ${RELOCATING+*(.rel.rodata:*)}
0220170b
DD
52 ${RELOCATING+*(.rel.gnu.linkonce.r*)}
53 }
54 .rela.rodata ${RELOCATING-0} :
55 {
56 *(.rela.rodata)
57 ${RELOCATING+*(.rela.rodata.*)}
493ffac5 58 ${RELOCATING+*(.rela.rodata:*)}
0220170b
DD
59 ${RELOCATING+*(.rela.gnu.linkonce.r*)}
60 }
61 .rel.data ${RELOCATING-0} :
62 {
63 *(.rel.data)
64 ${RELOCATING+*(.rel.data.*)}
493ffac5 65 ${RELOCATING+*(.rel.data:*)}
0220170b
DD
66 ${RELOCATING+*(.rel.gnu.linkonce.d*)}
67 }
68 .rela.data ${RELOCATING-0} :
69 {
70 *(.rela.data)
71 ${RELOCATING+*(.rela.data.*)}
493ffac5 72 ${RELOCATING+*(.rela.data:*)}
0220170b
DD
73 ${RELOCATING+*(.rela.gnu.linkonce.d*)}
74 }
493ffac5
DD
75 .rel.init_array ${RELOCATING-0} : { *(.rel.init_array) }
76 .rela.init_array ${RELOCATING-0} : { *(.rela.init_array) }
77 .rel.fini_array ${RELOCATING-0} : { *(.rel.fini_array) }
78 .rela.fini_array ${RELOCATING-0} : { *(.rela.fini_array) }
79 .rel.got ${RELOCATING-0} : { *(.rel.got) }
80 .rela.got ${RELOCATING-0} : { *(.rela.got) }
81 .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
82 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
83 .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
84 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
0220170b
DD
85
86 /* Internal text space. */
87 .text ${RELOCATING-0} :
88 {
89 ${RELOCATING+ _text_start = . ; }
90
91 ${RELOCATING+. = ALIGN(4);}
92
93 ${RELOCATING+*(.init0) /* Start here after reset. */}
94 ${RELOCATING+KEEP (*(.init0))}
95
96 ${RELOCATING+. = ALIGN(4);}
97 *(.text)
98 ${RELOCATING+. = ALIGN(4);}
99 ${RELOCATING+*(.text.*)}
100 ${RELOCATING+. = ALIGN(4);}
493ffac5
DD
101 ${RELOCATING+*(.text:*)}
102 ${RELOCATING+. = ALIGN(4);}
0220170b
DD
103 ${RELOCATING+*(.gnu.linkonce.t*)}
104 ${RELOCATING+. = ALIGN(4);}
105
106 ${RELOCATING+ _text_end = . ; }
107 } ${RELOCATING+ > imem}
108
109 .data ${RELOCATING-0} :
110 {
111 /* Optional variable that user is prepared to have NULL address. */
112 ${RELOCATING+ *(.data.atzero*)}
113
114 /* CRT is prepared for constructor/destructor table to have
115 a "valid" NULL address. */
493ffac5
DD
116 ${CONSTRUCTING+ __init_array_begin = . ; }
117 ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))}
118 ${CONSTRUCTING+ KEEP (*(.init_array))}
119 ${CONSTRUCTING+ __init_array_end = . ; }
120 ${CONSTRUCTING+ __fini_array_begin = . ; }
121 ${CONSTRUCTING+ KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))}
122 ${CONSTRUCTING+ KEEP (*(.fini_array))}
123 ${CONSTRUCTING+ __fini_array_end = . ; }
0220170b
DD
124
125 /* DATA memory starts at address 0. So to avoid placing a valid static
126 variable at the invalid NULL address, we introduce the .data.atzero
127 section. If CRT can make some use of it - great. Otherwise skip a
128 word. In all cases .data/.bss sections must start at non-zero. */
129 . += (. == 0 ? 4 : 0);
130
131 ${RELOCATING+ PROVIDE (_data_start = .) ; }
132 *(.data)
133 ${RELOCATING+ *(.data*)}
493ffac5 134 ${RELOCATING+ *(.data:*)}
0220170b
DD
135 ${RELOCATING+ *(.rodata) /* We need to include .rodata here if gcc is used. */}
136 ${RELOCATING+ *(.rodata.*) /* with -fdata-sections. */}
493ffac5 137 ${RELOCATING+ *(.rodata:*)}
0220170b
DD
138 ${RELOCATING+*(.gnu.linkonce.d*)}
139 ${RELOCATING+*(.gnu.linkonce.r*)}
140 ${RELOCATING+. = ALIGN(4);}
141 ${RELOCATING+ PROVIDE (_data_end = .) ; }
142 } ${RELOCATING+ > dmem }
143
144 .resource_table ${RELOCATING-0} :
145 {
146 *(.resource_table)
147 KEEP (*(.resource_table))
148 } > dmem
149
150 .bss ${RELOCATING-0} :
151 {
152 ${RELOCATING+ PROVIDE (_bss_start = .) ; }
153 *(.bss)
154 ${RELOCATING+ *(.bss.*)}
493ffac5 155 ${RELOCATING+ *(.bss:*)}
0220170b
DD
156 ${RELOCATING+*(.gnu.linkonce.b*)}
157 *(COMMON)
158 ${RELOCATING+ PROVIDE (_bss_end = .) ; }
159 } ${RELOCATING+ > dmem}
160
161 /* Global data not cleared after reset. */
162 .noinit ${RELOCATING-0}:
163 {
164 ${RELOCATING+ PROVIDE (_noinit_start = .) ; }
165 *(.noinit)
166 ${RELOCATING+ PROVIDE (_noinit_end = .) ; }
167 ${RELOCATING+ PROVIDE (_heap_start = .) ; }
168 ${RELOCATING+ . += __HEAP_SIZE ; }
169 /* Stack is not here really. It will be put at the end of DMEM.
170 But we take into account its size here, in order to allow
171 for MEMORY overflow checking during link time. */
172 ${RELOCATING+ . += __STACK_SIZE ; }
173 } ${RELOCATING+ > dmem}
174
175 /* Stabs debugging sections. */
176 .stab 0 : { *(.stab) }
177 .stabstr 0 : { *(.stabstr) }
178 .stab.excl 0 : { *(.stab.excl) }
179 .stab.exclstr 0 : { *(.stab.exclstr) }
180 .stab.index 0 : { *(.stab.index) }
181 .stab.indexstr 0 : { *(.stab.indexstr) }
182 .comment 0 : { *(.comment) }
183 .note.gnu.build-id : { *(.note.gnu.build-id) }
184EOF
185
186. $srcdir/scripttempl/DWARF.sc
187
188cat <<EOF
189}
190EOF
This page took 0.087791 seconds and 4 git commands to generate.