blob: 87146235fe1f1c3030e420daffecaabd18685094 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001/* Script for --shared -z combreloc -z now -z relro: shared library, combine & sort relocs */
2OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
3 "elf64-x86-64")
4OUTPUT_ARCH(i386:x86-64)
5ENTRY(_start)
6SEARCH_DIR("/build/output/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/build/output/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_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.ifunc)
36 }
37 .rela.plt :
38 {
39 *(.rela.plt)
40 *(.rela.iplt)
41 }
42 .init :
43 {
44 KEEP (*(SORT_NONE(.init)))
45 }
46 .plt : { *(.plt) *(.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.plt) *(.igot.plt) *(.got) *(.igot) }
130 . = DATA_SEGMENT_RELRO_END (0, .);
131 .data :
132 {
133 *(.data .data.* .gnu.linkonce.d.*)
134 SORT(CONSTRUCTORS)
135 }
136 .data1 : { *(.data1) }
137 _edata = .; PROVIDE (edata = .);
138 . = .;
139 __bss_start = .;
140 .bss :
141 {
142 *(.dynbss)
143 *(.bss .bss.* .gnu.linkonce.b.*)
144 *(COMMON)
145 /* Align here to ensure that the .bss section occupies space up to
146 _end. Align after .bss to ensure correct alignment even if the
147 .bss section disappears because there are no input sections.
148 FIXME: Why do we need it? When there is no .bss section, we don't
149 pad the .data section. */
150 . = ALIGN(. != 0 ? 64 / 8 : 1);
151 }
152 .lbss :
153 {
154 *(.dynlbss)
155 *(.lbss .lbss.* .gnu.linkonce.lb.*)
156 *(LARGE_COMMON)
157 }
158 . = ALIGN(64 / 8);
159 . = SEGMENT_START("ldata-segment", .);
160 .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
161 {
162 *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
163 }
164 .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
165 {
166 *(.ldata .ldata.* .gnu.linkonce.l.*)
167 . = ALIGN(. != 0 ? 64 / 8 : 1);
168 }
169 . = ALIGN(64 / 8);
170 _end = .; PROVIDE (end = .);
171 . = DATA_SEGMENT_END (.);
172 /* Stabs debugging sections. */
173 .stab 0 : { *(.stab) }
174 .stabstr 0 : { *(.stabstr) }
175 .stab.excl 0 : { *(.stab.excl) }
176 .stab.exclstr 0 : { *(.stab.exclstr) }
177 .stab.index 0 : { *(.stab.index) }
178 .stab.indexstr 0 : { *(.stab.indexstr) }
179 .comment 0 : { *(.comment) }
180 /* DWARF debug sections.
181 Symbols in the DWARF debugging sections are relative to the beginning
182 of the section so we begin them at 0. */
183 /* DWARF 1 */
184 .debug 0 : { *(.debug) }
185 .line 0 : { *(.line) }
186 /* GNU DWARF 1 extensions */
187 .debug_srcinfo 0 : { *(.debug_srcinfo) }
188 .debug_sfnames 0 : { *(.debug_sfnames) }
189 /* DWARF 1.1 and DWARF 2 */
190 .debug_aranges 0 : { *(.debug_aranges) }
191 .debug_pubnames 0 : { *(.debug_pubnames) }
192 /* DWARF 2 */
193 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
194 .debug_abbrev 0 : { *(.debug_abbrev) }
195 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
196 .debug_frame 0 : { *(.debug_frame) }
197 .debug_str 0 : { *(.debug_str) }
198 .debug_loc 0 : { *(.debug_loc) }
199 .debug_macinfo 0 : { *(.debug_macinfo) }
200 /* SGI/MIPS DWARF 2 extensions */
201 .debug_weaknames 0 : { *(.debug_weaknames) }
202 .debug_funcnames 0 : { *(.debug_funcnames) }
203 .debug_typenames 0 : { *(.debug_typenames) }
204 .debug_varnames 0 : { *(.debug_varnames) }
205 /* DWARF 3 */
206 .debug_pubtypes 0 : { *(.debug_pubtypes) }
207 .debug_ranges 0 : { *(.debug_ranges) }
208 /* DWARF Extension. */
209 .debug_macro 0 : { *(.debug_macro) }
210 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
211 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
212}