1 | /* linkcmds |
---|
2 | */ |
---|
3 | |
---|
4 | /* |
---|
5 | * For alignment, SPARC v9 specifies that instructions are 4-byte aligned, |
---|
6 | * and the worst-case alignment requirements for data are for quad-word |
---|
7 | * accesses, which must be 16-byte aligned. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * Declare some sizes. |
---|
12 | */ |
---|
13 | RamBase = DEFINED(RamBase) ? RamBase : 0x0; |
---|
14 | RamSize = DEFINED(RamSize) ? RamSize : 4M; |
---|
15 | HeapSize = DEFINED(HeapSize) ? HeapSize : 1M; |
---|
16 | |
---|
17 | RAM_END = RamBase + RamSize; |
---|
18 | |
---|
19 | /* Default linker script, for normal executables */ |
---|
20 | OUTPUT_FORMAT("elf64-sparc") |
---|
21 | ENTRY(_start) |
---|
22 | STARTUP(start.o) |
---|
23 | |
---|
24 | MEMORY |
---|
25 | { |
---|
26 | ram : ORIGIN = 0x0, LENGTH = 12M |
---|
27 | } |
---|
28 | |
---|
29 | SECTIONS |
---|
30 | { |
---|
31 | /* Read-only sections, merged into text segment: */ |
---|
32 | .hash : { *(.hash) } |
---|
33 | .dynsym : { *(.dynsym) } |
---|
34 | .dynstr : { *(.dynstr) } |
---|
35 | .gnu.version : { *(.gnu.version) } |
---|
36 | .gnu.version_d : { *(.gnu.version_d) } |
---|
37 | .gnu.version_r : { *(.gnu.version_r) } |
---|
38 | .rel.init : { *(.rel.init) } |
---|
39 | .rela.init : { *(.rela.init) } |
---|
40 | .rel.text : |
---|
41 | { |
---|
42 | *(.rel.text) |
---|
43 | *(.rel.text.*) |
---|
44 | *(.rel.gnu.linkonce.t*) |
---|
45 | } |
---|
46 | .rela.text : |
---|
47 | { |
---|
48 | *(.rela.text) |
---|
49 | *(.rela.text.*) |
---|
50 | *(.rela.gnu.linkonce.t*) |
---|
51 | } |
---|
52 | .rel.fini : { *(.rel.fini) } |
---|
53 | .rela.fini : { *(.rela.fini) } |
---|
54 | .rel.rodata : |
---|
55 | { |
---|
56 | *(.rel.rodata) |
---|
57 | *(.rel.rodata.*) |
---|
58 | *(.rel.gnu.linkonce.r*) |
---|
59 | } |
---|
60 | .rela.rodata : |
---|
61 | { |
---|
62 | *(.rela.rodata) |
---|
63 | *(.rela.rodata.*) |
---|
64 | *(.rela.gnu.linkonce.r*) |
---|
65 | } |
---|
66 | .rel.data : |
---|
67 | { |
---|
68 | *(.rel.data) |
---|
69 | *(.rel.data.*) |
---|
70 | *(.rel.gnu.linkonce.d*) |
---|
71 | } |
---|
72 | .rela.data : |
---|
73 | { |
---|
74 | *(.rela.data) |
---|
75 | *(.rela.data.*) |
---|
76 | *(.rela.gnu.linkonce.d*) |
---|
77 | } |
---|
78 | .rel.ctors : { *(.rel.ctors) } |
---|
79 | .rela.ctors : { *(.rela.ctors) } |
---|
80 | .rel.dtors : { *(.rel.dtors) } |
---|
81 | .rela.dtors : { *(.rela.dtors) } |
---|
82 | .rel.got : { *(.rel.got) } |
---|
83 | .rela.got : { *(.rela.got) } |
---|
84 | .rel.bss : { *(.rel.bss) } |
---|
85 | .rela.bss : { *(.rela.bss) } |
---|
86 | .rel.plt : { *(.rel.plt) } |
---|
87 | .rela.plt : { *(.rela.plt) } |
---|
88 | /* Internal text space or external memory */ |
---|
89 | .text 0x4000 : AT (0x4000) |
---|
90 | { |
---|
91 | *(BOOTSTRAP); |
---|
92 | *(.text*) |
---|
93 | |
---|
94 | KEEP (*(.init)) |
---|
95 | KEEP (*(.fini)) |
---|
96 | |
---|
97 | /* |
---|
98 | * Special FreeBSD sysctl sections. |
---|
99 | */ |
---|
100 | . = ALIGN (16); |
---|
101 | __start_set_sysctl_set = .; |
---|
102 | *(set_sysctl_*); |
---|
103 | __stop_set_sysctl_set = ABSOLUTE(.); |
---|
104 | *(set_domain_*); |
---|
105 | *(set_pseudo_*); |
---|
106 | |
---|
107 | *(.eh_frame) |
---|
108 | . = ALIGN (16); |
---|
109 | |
---|
110 | *(.gnu.linkonce.t*) |
---|
111 | *(.gcc_except_table*) |
---|
112 | |
---|
113 | /* |
---|
114 | * C++ constructors |
---|
115 | */ |
---|
116 | /* gcc uses crtbegin.o to find the start of |
---|
117 | the constructors, so we make sure it is |
---|
118 | first. Because this is a wildcard, it |
---|
119 | doesn't matter if the user does not |
---|
120 | actually link against crtbegin.o; the |
---|
121 | linker won't look for a file to match a |
---|
122 | wildcard. The wildcard also means that it |
---|
123 | doesn't matter which directory crtbegin.o |
---|
124 | is in. */ |
---|
125 | KEEP (*crtbegin.o(.ctors)) |
---|
126 | KEEP (*crtbegin?.o(.ctors)) |
---|
127 | /* We don't want to include the .ctor section from |
---|
128 | the crtend.o file until after the sorted ctors. |
---|
129 | The .ctor section from the crtend file contains the |
---|
130 | end of ctors marker and it must be last */ |
---|
131 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) |
---|
132 | KEEP (*(SORT(.ctors.*))) |
---|
133 | KEEP (*(.ctors)) |
---|
134 | KEEP (*crtbegin.o(.dtors)) |
---|
135 | KEEP (*crtbegin?.o(.dtors)) |
---|
136 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) |
---|
137 | KEEP (*(SORT(.dtors.*))) |
---|
138 | KEEP (*(.dtors)) |
---|
139 | |
---|
140 | _rodata_start = . ; |
---|
141 | *(.rodata*) |
---|
142 | KEEP (*(SORT(.rtemsroset.*))) |
---|
143 | *(.gnu.linkonce.r*) |
---|
144 | _erodata = ALIGN( 0x10 ) ; |
---|
145 | |
---|
146 | *(.lit) |
---|
147 | *(.shdata) |
---|
148 | |
---|
149 | . = ALIGN (16); |
---|
150 | _endtext = . ; |
---|
151 | _etext = . ; |
---|
152 | } > ram |
---|
153 | |
---|
154 | .tdata : AT (ADDR (.text) + SIZEOF (.text)) { |
---|
155 | _TLS_Data_begin = .; |
---|
156 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
157 | _TLS_Data_end = .; |
---|
158 | } > ram |
---|
159 | .tbss : AT (ADDR (.tdata) + SIZEOF (.tdata)) { |
---|
160 | _TLS_BSS_begin = .; |
---|
161 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
162 | _TLS_BSS_end = .; |
---|
163 | } > ram |
---|
164 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
165 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
166 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
167 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
168 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
169 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
170 | |
---|
171 | .data : AT (ADDR (.tbss) + SIZEOF (.tbss)) |
---|
172 | { |
---|
173 | PROVIDE (__data_start = .) ; |
---|
174 | data_start = . ; |
---|
175 | _data_start = . ; |
---|
176 | *(.data) |
---|
177 | *(.data*) |
---|
178 | KEEP (*(SORT(.rtemsrwset.*))) |
---|
179 | *(.rodata) /* We need to include .rodata here if gcc is used */ |
---|
180 | *(.rodata*) /* with -fdata-sections. */ |
---|
181 | *(.gnu.linkonce.d*) |
---|
182 | . = ALIGN(2); |
---|
183 | edata = . ; |
---|
184 | _edata = . ; |
---|
185 | PROVIDE (__data_end = .) ; |
---|
186 | } > ram |
---|
187 | |
---|
188 | /* XXX |
---|
189 | __data_load_start = LOADADDR(.data); |
---|
190 | __data_load_end = __data_load_start + SIZEOF(.data); |
---|
191 | */ |
---|
192 | . = ALIGN (16); |
---|
193 | .dynamic : { *(.dynamic) } >ram |
---|
194 | .jcr : { *(.jcr) } > ram |
---|
195 | .shbss : { *(.shbss) } > ram |
---|
196 | .bss : |
---|
197 | { |
---|
198 | FILL(0x00000000); |
---|
199 | . = ALIGN(16); |
---|
200 | __bss_start = ALIGN(0x8); |
---|
201 | bss_start = .; |
---|
202 | bss_start = .; |
---|
203 | *(.bss .bss* .gnu.linkonce.b*) |
---|
204 | *(COMMON) |
---|
205 | . = ALIGN (16); |
---|
206 | end = .; |
---|
207 | _end = .; |
---|
208 | __end = .; |
---|
209 | |
---|
210 | . = ALIGN (16); /* arbitrary alignment */ |
---|
211 | PROVIDE (WorkAreaBase = .); |
---|
212 | . += HeapSize; |
---|
213 | PROVIDE (HeapBase = .); |
---|
214 | . += HeapSize; |
---|
215 | } > ram |
---|
216 | } |
---|
217 | |
---|
218 | |
---|