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