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