blob: ef4885f28eb12f8369af48691a4e584caba2ed96 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001/* Script for ld -pie: link position independent executable */
2OUTPUT_FORMAT("elf64-l1om", "elf64-l1om",
3 "elf64-l1om")
4OUTPUT_ARCH(l1om)
5ENTRY(_start)
6SEARCH_DIR("/build/output/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/build/output/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
7SECTIONS
8{
9 /* Read-only sections, merged into text segment: */
10 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0)); . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
11 .interp : { *(.interp) }
12 .note.gnu.build-id : { *(.note.gnu.build-id) }
13 .hash : { *(.hash) }
14 .gnu.hash : { *(.gnu.hash) }
15 .dynsym : { *(.dynsym) }
16 .dynstr : { *(.dynstr) }
17 .gnu.version : { *(.gnu.version) }
18 .gnu.version_d : { *(.gnu.version_d) }
19 .gnu.version_r : { *(.gnu.version_r) }
20 .rela.init : { *(.rela.init) }
21 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
22 .rela.fini : { *(.rela.fini) }
23 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
24 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
25 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
26 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
27 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
28 .rela.ctors : { *(.rela.ctors) }
29 .rela.dtors : { *(.rela.dtors) }
30 .rela.got : { *(.rela.got) }
31 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
32 .rela.ldata : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) }
33 .rela.lbss : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) }
34 .rela.lrodata : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) }
35 .rela.iplt :
36 {
37 PROVIDE_HIDDEN (__rela_iplt_start = .);
38 *(.rela.iplt)
39 PROVIDE_HIDDEN (__rela_iplt_end = .);
40 }
41 .rela.plt :
42 {
43 *(.rela.plt)
44 }
45 .init :
46 {
47 KEEP (*(SORT_NONE(.init)))
48 }
49 .plt : { *(.plt) }
50 .iplt : { *(.iplt) }
51 .text :
52 {
53 *(.text.unlikely .text.*_unlikely .text.unlikely.*)
54 *(.text.exit .text.exit.*)
55 *(.text.startup .text.startup.*)
56 *(.text.hot .text.hot.*)
57 *(.text .stub .text.* .gnu.linkonce.t.*)
58 /* .gnu.warning sections are handled specially by elf32.em. */
59 *(.gnu.warning)
60 }
61 .fini :
62 {
63 KEEP (*(SORT_NONE(.fini)))
64 }
65 PROVIDE (__etext = .);
66 PROVIDE (_etext = .);
67 PROVIDE (etext = .);
68 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
69 .rodata1 : { *(.rodata1) }
70 .eh_frame_hdr : { *(.eh_frame_hdr) }
71 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
72 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
73 .gcc_except_table.*) }
74 /* These sections are generated by the Sun/Oracle C++ compiler. */
75 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
76 .exception_ranges*) }
77 /* Adjust the address for the data segment. We want to adjust up to
78 the same address within the page on the next page up. */
79 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
80 /* Exception handling */
81 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
82 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
83 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
84 /* Thread Local Storage sections */
85 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
86 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
87 .preinit_array :
88 {
89 PROVIDE_HIDDEN (__preinit_array_start = .);
90 KEEP (*(.preinit_array))
91 PROVIDE_HIDDEN (__preinit_array_end = .);
92 }
93 .init_array :
94 {
95 PROVIDE_HIDDEN (__init_array_start = .);
96 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
97 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
98 PROVIDE_HIDDEN (__init_array_end = .);
99 }
100 .fini_array :
101 {
102 PROVIDE_HIDDEN (__fini_array_start = .);
103 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
104 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
105 PROVIDE_HIDDEN (__fini_array_end = .);
106 }
107 .ctors :
108 {
109 /* gcc uses crtbegin.o to find the start of
110 the constructors, so we make sure it is
111 first. Because this is a wildcard, it
112 doesn't matter if the user does not
113 actually link against crtbegin.o; the
114 linker won't look for a file to match a
115 wildcard. The wildcard also means that it
116 doesn't matter which directory crtbegin.o
117 is in. */
118 KEEP (*crtbegin.o(.ctors))
119 KEEP (*crtbegin?.o(.ctors))
120 /* We don't want to include the .ctor section from
121 the crtend.o file until after the sorted ctors.
122 The .ctor section from the crtend file contains the
123 end of ctors marker and it must be last */
124 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
125 KEEP (*(SORT(.ctors.*)))
126 KEEP (*(.ctors))
127 }
128 .dtors :
129 {
130 KEEP (*crtbegin.o(.dtors))
131 KEEP (*crtbegin?.o(.dtors))
132 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
133 KEEP (*(SORT(.dtors.*)))
134 KEEP (*(.dtors))
135 }
136 .jcr : { KEEP (*(.jcr)) }
137 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
138 .dynamic : { *(.dynamic) }
139 .got : { *(.got) *(.igot) }
140 . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .);
141 .got.plt : { *(.got.plt) *(.igot.plt) }
142 .data :
143 {
144 *(.data .data.* .gnu.linkonce.d.*)
145 SORT(CONSTRUCTORS)
146 }
147 .data1 : { *(.data1) }
148 _edata = .; PROVIDE (edata = .);
149 . = .;
150 __bss_start = .;
151 .bss :
152 {
153 *(.dynbss)
154 *(.bss .bss.* .gnu.linkonce.b.*)
155 *(COMMON)
156 /* Align here to ensure that the .bss section occupies space up to
157 _end. Align after .bss to ensure correct alignment even if the
158 .bss section disappears because there are no input sections.
159 FIXME: Why do we need it? When there is no .bss section, we don't
160 pad the .data section. */
161 . = ALIGN(. != 0 ? 64 / 8 : 1);
162 }
163 .lbss :
164 {
165 *(.dynlbss)
166 *(.lbss .lbss.* .gnu.linkonce.lb.*)
167 *(LARGE_COMMON)
168 }
169 . = ALIGN(64 / 8);
170 . = SEGMENT_START("ldata-segment", .);
171 .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
172 {
173 *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
174 }
175 .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
176 {
177 *(.ldata .ldata.* .gnu.linkonce.l.*)
178 . = ALIGN(. != 0 ? 64 / 8 : 1);
179 }
180 . = ALIGN(64 / 8);
181 _end = .; PROVIDE (end = .);
182 . = DATA_SEGMENT_END (.);
183 /* Stabs debugging sections. */
184 .stab 0 : { *(.stab) }
185 .stabstr 0 : { *(.stabstr) }
186 .stab.excl 0 : { *(.stab.excl) }
187 .stab.exclstr 0 : { *(.stab.exclstr) }
188 .stab.index 0 : { *(.stab.index) }
189 .stab.indexstr 0 : { *(.stab.indexstr) }
190 .comment 0 : { *(.comment) }
191 /* DWARF debug sections.
192 Symbols in the DWARF debugging sections are relative to the beginning
193 of the section so we begin them at 0. */
194 /* DWARF 1 */
195 .debug 0 : { *(.debug) }
196 .line 0 : { *(.line) }
197 /* GNU DWARF 1 extensions */
198 .debug_srcinfo 0 : { *(.debug_srcinfo) }
199 .debug_sfnames 0 : { *(.debug_sfnames) }
200 /* DWARF 1.1 and DWARF 2 */
201 .debug_aranges 0 : { *(.debug_aranges) }
202 .debug_pubnames 0 : { *(.debug_pubnames) }
203 /* DWARF 2 */
204 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
205 .debug_abbrev 0 : { *(.debug_abbrev) }
206 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
207 .debug_frame 0 : { *(.debug_frame) }
208 .debug_str 0 : { *(.debug_str) }
209 .debug_loc 0 : { *(.debug_loc) }
210 .debug_macinfo 0 : { *(.debug_macinfo) }
211 /* SGI/MIPS DWARF 2 extensions */
212 .debug_weaknames 0 : { *(.debug_weaknames) }
213 .debug_funcnames 0 : { *(.debug_funcnames) }
214 .debug_typenames 0 : { *(.debug_typenames) }
215 .debug_varnames 0 : { *(.debug_varnames) }
216 /* DWARF 3 */
217 .debug_pubtypes 0 : { *(.debug_pubtypes) }
218 .debug_ranges 0 : { *(.debug_ranges) }
219 /* DWARF Extension. */
220 .debug_macro 0 : { *(.debug_macro) }
221 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
222 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
223}