1 | /* Copyright (C) 2014-2018 Free Software Foundation, Inc. |
---|
2 | Copying and distribution of this script, with or without modification, |
---|
3 | are permitted in any medium without royalty provided the copyright |
---|
4 | notice and this notice are preserved. */ |
---|
5 | |
---|
6 | /* |
---|
7 | * Copy of default linker script generated with: |
---|
8 | * x86_64-rtems5-ld --verbose |
---|
9 | * |
---|
10 | * Changes: |
---|
11 | * - Added HeapSize, RamBase, RamSize, WorkBase |
---|
12 | * - rtemssroset section |
---|
13 | * - rtemsstack section |
---|
14 | */ |
---|
15 | |
---|
16 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", |
---|
17 | "elf64-x86-64") |
---|
18 | OUTPUT_ARCH(i386:x86-64) |
---|
19 | ENTRY(_start) |
---|
20 | |
---|
21 | HeapSize = DEFINED(HeapSize) ? HeapSize : |
---|
22 | DEFINED(_HeapSize) ? _HeapSize : 0x0; |
---|
23 | RamBase = DEFINED(RamBase) ? RamBase : |
---|
24 | DEFINED(_RamBase) ? _RamBase : 0x0; |
---|
25 | |
---|
26 | /* XXX: Defaulting to 4GiB. |
---|
27 | */ |
---|
28 | RamSize = DEFINED(RamSize) ? RamSize : |
---|
29 | DEFINED(_RamSize) ? _RamSize : 0xFFFFFFFF; |
---|
30 | |
---|
31 | SECTIONS |
---|
32 | { |
---|
33 | /* Read-only sections, merged into text segment: */ |
---|
34 | PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; |
---|
35 | .interp : { *(.interp) } |
---|
36 | .note.gnu.build-id : { *(.note.gnu.build-id) } |
---|
37 | .hash : { *(.hash) } |
---|
38 | .gnu.hash : { *(.gnu.hash) } |
---|
39 | .dynsym : { *(.dynsym) } |
---|
40 | .dynstr : { *(.dynstr) } |
---|
41 | .gnu.version : { *(.gnu.version) } |
---|
42 | .gnu.version_d : { *(.gnu.version_d) } |
---|
43 | .gnu.version_r : { *(.gnu.version_r) } |
---|
44 | .rela.dyn : |
---|
45 | { |
---|
46 | *(.rela.init) |
---|
47 | *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) |
---|
48 | *(.rela.fini) |
---|
49 | *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) |
---|
50 | *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) |
---|
51 | *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) |
---|
52 | *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) |
---|
53 | *(.rela.ctors) |
---|
54 | *(.rela.dtors) |
---|
55 | *(.rela.got) |
---|
56 | *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) |
---|
57 | *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) |
---|
58 | *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) |
---|
59 | *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) |
---|
60 | *(.rela.ifunc) |
---|
61 | } |
---|
62 | .rela.plt : |
---|
63 | { |
---|
64 | *(.rela.plt) |
---|
65 | PROVIDE_HIDDEN (__rela_iplt_start = .); |
---|
66 | *(.rela.iplt) |
---|
67 | PROVIDE_HIDDEN (__rela_iplt_end = .); |
---|
68 | } |
---|
69 | .rtemsroset : { |
---|
70 | /* for pre rtems-libbsd FreeBSD code */ |
---|
71 | __start_set_sysctl_set = .; |
---|
72 | *(set_sysctl_*); |
---|
73 | __stop_set_sysctl_set = .; |
---|
74 | *(set_domain_*); |
---|
75 | *(set_pseudo_*); |
---|
76 | |
---|
77 | KEEP (*(SORT(.rtemsroset.*))) |
---|
78 | } =0x90909090 |
---|
79 | .init : |
---|
80 | { |
---|
81 | KEEP (*(SORT_NONE(.init))) |
---|
82 | } |
---|
83 | .plt : { *(.plt) *(.iplt) } |
---|
84 | .plt.got : { *(.plt.got) } |
---|
85 | .plt.sec : { *(.plt.sec) } |
---|
86 | .text : |
---|
87 | { |
---|
88 | *(.text.unlikely .text.*_unlikely .text.unlikely.*) |
---|
89 | *(.text.exit .text.exit.*) |
---|
90 | *(.text.startup .text.startup.*) |
---|
91 | *(.text.hot .text.hot.*) |
---|
92 | *(.text .stub .text.* .gnu.linkonce.t.*) |
---|
93 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
94 | *(.gnu.warning) |
---|
95 | } |
---|
96 | .fini : |
---|
97 | { |
---|
98 | KEEP (*(SORT_NONE(.fini))) |
---|
99 | } |
---|
100 | PROVIDE (__etext = .); |
---|
101 | PROVIDE (_etext = .); |
---|
102 | PROVIDE (etext = .); |
---|
103 | .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
---|
104 | .rodata1 : { *(.rodata1) } |
---|
105 | .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } |
---|
106 | .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } |
---|
107 | .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table |
---|
108 | .gcc_except_table.*) } |
---|
109 | .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } |
---|
110 | /* These sections are generated by the Sun/Oracle C++ compiler. */ |
---|
111 | .exception_ranges : ONLY_IF_RO { *(.exception_ranges |
---|
112 | .exception_ranges*) } |
---|
113 | /* Adjust the address for the data segment. We want to adjust up to |
---|
114 | the same address within the page on the next page up. */ |
---|
115 | . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); |
---|
116 | /* Exception handling */ |
---|
117 | .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } |
---|
118 | .gnu_extab : ONLY_IF_RW { *(.gnu_extab) } |
---|
119 | .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } |
---|
120 | .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } |
---|
121 | /* Thread Local Storage sections */ |
---|
122 | .tdata : { |
---|
123 | _TLS_Data_begin = .; |
---|
124 | *(.tdata .tdata.* .gnu.linkonce.td.*) |
---|
125 | _TLS_Data_end = .; |
---|
126 | } |
---|
127 | .tbss : { |
---|
128 | _TLS_BSS_begin = .; |
---|
129 | *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) |
---|
130 | _TLS_BSS_end = .; |
---|
131 | } |
---|
132 | _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; |
---|
133 | _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; |
---|
134 | _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; |
---|
135 | _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; |
---|
136 | _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; |
---|
137 | _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); |
---|
138 | .preinit_array : |
---|
139 | { |
---|
140 | PROVIDE_HIDDEN (__preinit_array_start = .); |
---|
141 | KEEP (*(.preinit_array)) |
---|
142 | PROVIDE_HIDDEN (__preinit_array_end = .); |
---|
143 | } |
---|
144 | .init_array : |
---|
145 | { |
---|
146 | PROVIDE_HIDDEN (__init_array_start = .); |
---|
147 | KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) |
---|
148 | KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) |
---|
149 | PROVIDE_HIDDEN (__init_array_end = .); |
---|
150 | } |
---|
151 | .fini_array : |
---|
152 | { |
---|
153 | PROVIDE_HIDDEN (__fini_array_start = .); |
---|
154 | KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) |
---|
155 | KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) |
---|
156 | PROVIDE_HIDDEN (__fini_array_end = .); |
---|
157 | } |
---|
158 | .ctors : |
---|
159 | { |
---|
160 | /* gcc uses crtbegin.o to find the start of |
---|
161 | the constructors, so we make sure it is |
---|
162 | first. Because this is a wildcard, it |
---|
163 | doesn't matter if the user does not |
---|
164 | actually link against crtbegin.o; the |
---|
165 | linker won't look for a file to match a |
---|
166 | wildcard. The wildcard also means that it |
---|
167 | doesn't matter which directory crtbegin.o |
---|
168 | is in. */ |
---|
169 | KEEP (*crtbegin.o(.ctors)) |
---|
170 | KEEP (*crtbegin?.o(.ctors)) |
---|
171 | /* We don't want to include the .ctor section from |
---|
172 | the crtend.o file until after the sorted ctors. |
---|
173 | The .ctor section from the crtend file contains the |
---|
174 | end of ctors marker and it must be last */ |
---|
175 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) |
---|
176 | KEEP (*(SORT(.ctors.*))) |
---|
177 | KEEP (*(.ctors)) |
---|
178 | } |
---|
179 | .dtors : |
---|
180 | { |
---|
181 | KEEP (*crtbegin.o(.dtors)) |
---|
182 | KEEP (*crtbegin?.o(.dtors)) |
---|
183 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) |
---|
184 | KEEP (*(SORT(.dtors.*))) |
---|
185 | KEEP (*(.dtors)) |
---|
186 | } |
---|
187 | .jcr : { KEEP (*(.jcr)) } |
---|
188 | .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } |
---|
189 | .dynamic : { *(.dynamic) } |
---|
190 | .got : { *(.got) *(.igot) } |
---|
191 | . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .); |
---|
192 | .got.plt : { *(.got.plt) *(.igot.plt) } |
---|
193 | .data : |
---|
194 | { |
---|
195 | *(.data .data.* .gnu.linkonce.d.*) |
---|
196 | SORT(CONSTRUCTORS) |
---|
197 | } |
---|
198 | .data1 : { *(.data1) } |
---|
199 | _edata = .; PROVIDE (edata = .); |
---|
200 | . = .; |
---|
201 | __bss_start = .; |
---|
202 | .bss : |
---|
203 | { |
---|
204 | *(.dynbss) |
---|
205 | *(.bss .bss.* .gnu.linkonce.b.*) |
---|
206 | *(COMMON) |
---|
207 | /* Align here to ensure that the .bss section occupies space up to |
---|
208 | _end. Align after .bss to ensure correct alignment even if the |
---|
209 | .bss section disappears because there are no input sections. |
---|
210 | FIXME: Why do we need it? When there is no .bss section, we don't |
---|
211 | pad the .data section. */ |
---|
212 | . = ALIGN(. != 0 ? 64 / 8 : 1); |
---|
213 | } |
---|
214 | .lbss : |
---|
215 | { |
---|
216 | *(.dynlbss) |
---|
217 | *(.lbss .lbss.* .gnu.linkonce.lb.*) |
---|
218 | *(LARGE_COMMON) |
---|
219 | } |
---|
220 | . = ALIGN(64 / 8); |
---|
221 | . = SEGMENT_START("ldata-segment", .); |
---|
222 | .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : |
---|
223 | { |
---|
224 | *(.lrodata .lrodata.* .gnu.linkonce.lr.*) |
---|
225 | } |
---|
226 | .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : |
---|
227 | { |
---|
228 | *(.ldata .ldata.* .gnu.linkonce.l.*) |
---|
229 | . = ALIGN(. != 0 ? 64 / 8 : 1); |
---|
230 | } |
---|
231 | . = ALIGN(64 / 8); |
---|
232 | _end = .; PROVIDE (end = .); |
---|
233 | .rtemsstack (NOLOAD) : |
---|
234 | { |
---|
235 | *(SORT(.rtemsstack.*)) |
---|
236 | } |
---|
237 | WorkAreaBase = .; |
---|
238 | . = DATA_SEGMENT_END (.); |
---|
239 | /* Stabs debugging sections. */ |
---|
240 | |
---|
241 | .stab 0 : { *(.stab) } |
---|
242 | .stabstr 0 : { *(.stabstr) } |
---|
243 | .stab.excl 0 : { *(.stab.excl) } |
---|
244 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
245 | .stab.index 0 : { *(.stab.index) } |
---|
246 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
247 | .comment 0 : { *(.comment) } |
---|
248 | /* DWARF debug sections. |
---|
249 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
250 | of the section so we begin them at 0. */ |
---|
251 | /* DWARF 1 */ |
---|
252 | .debug 0 : { *(.debug) } |
---|
253 | .line 0 : { *(.line) } |
---|
254 | /* GNU DWARF 1 extensions */ |
---|
255 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
256 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
257 | /* DWARF 1.1 and DWARF 2 */ |
---|
258 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
259 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
260 | /* DWARF 2 */ |
---|
261 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
262 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
263 | .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } |
---|
264 | .debug_frame 0 : { *(.debug_frame) } |
---|
265 | .debug_str 0 : { *(.debug_str) } |
---|
266 | .debug_loc 0 : { *(.debug_loc) } |
---|
267 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
268 | /* SGI/MIPS DWARF 2 extensions */ |
---|
269 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
270 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
271 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
272 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
273 | /* DWARF 3 */ |
---|
274 | .debug_pubtypes 0 : { *(.debug_pubtypes) } |
---|
275 | .debug_ranges 0 : { *(.debug_ranges) } |
---|
276 | /* DWARF Extension. */ |
---|
277 | .debug_macro 0 : { *(.debug_macro) } |
---|
278 | .debug_addr 0 : { *(.debug_addr) } |
---|
279 | .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } |
---|
280 | /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } |
---|
281 | } |
---|