1 /* Script for --shared -z combreloc: shared library, combine & sort relocs */
2 /* Copyright (C) 2014-2018 Free Software Foundation, Inc.
3 Copying and distribution of this script, with or without modification,
4 are permitted in any medium without royalty provided the copyright
5 notice and this notice are preserved. */
6 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
8 OUTPUT_ARCH(i386:x86-64)
10 /* SEARCH_DIR("/nyan/toolchains/0/x86_64-nyan-linux-gnu/lib64"); SEARCH_DIR("/nyan/toolchains/0/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/nyan/toolchains/0/x86_64-nyan-linux-gnu/lib"); SEARCH_DIR("/nyan/toolchains/0/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); */
13 /* Read-only sections, merged into text segment: */
14 . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
15 .note.gnu.build-id : { *(.note.gnu.build-id) }
16 .note.ABI-tag : { *(.note.ABI-tag) } .gnu.hash : { *(.gnu.hash) }
17 .dynsym : { *(.dynsym) }
18 .dynstr : { *(.dynstr) }
19 .gnu.version : { *(.gnu.version) }
20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) }
25 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
27 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
28 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
29 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
30 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
34 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
35 *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
36 *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
37 *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
47 KEEP (*(SORT_NONE(.init)))
49 .plt : { *(.plt) *(.iplt) }
50 .plt.got : { *(.plt.got) }
51 .plt.sec : { *(.plt.sec) }
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. */
64 KEEP (*(SORT_NONE(.fini)))
66 PROVIDE (__etext = .);
69 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
70 .rodata1 : { *(.rodata1) }
71 .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
72 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
73 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
74 .gcc_except_table.*) }
75 .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
76 /* These sections are generated by the Sun/Oracle C++ compiler. */
77 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
79 /* Adjust the address for the data segment. We want to adjust up to
80 the same address within the page on the next page up. */
82 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
83 /* Exception handling */
84 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
85 .gnu_extab : ONLY_IF_RW { *(.gnu_extab) }
86 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
87 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
88 /* Thread Local Storage sections */
89 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
90 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
93 KEEP (*(.preinit_array))
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))
102 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
103 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
107 /* gcc uses crtbegin.o to find the start of
108 the constructors, so we make sure it is
109 first. Because this is a wildcard, it
110 doesn't matter if the user does not
111 actually link against crtbegin.o; the
112 linker won't look for a file to match a
113 wildcard. The wildcard also means that it
114 doesn't matter which directory crtbegin.o
116 KEEP (*crtbegin.o(.ctors))
117 KEEP (*crtbegin?.o(.ctors))
118 /* We don't want to include the .ctor section from
119 the crtend.o file until after the sorted ctors.
120 The .ctor section from the crtend file contains the
121 end of ctors marker and it must be last */
122 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
123 KEEP (*(SORT(.ctors.*)))
128 KEEP (*crtbegin.o(.dtors))
129 KEEP (*crtbegin?.o(.dtors))
130 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
131 KEEP (*(SORT(.dtors.*)))
134 .jcr : { KEEP (*(.jcr)) }
135 PROVIDE(__start___libc_subfreeres = .);
136 __libc_subfreeres : { *(__libc_subfreeres) }
137 PROVIDE(__stop___libc_subfreeres = .);
138 PROVIDE(__start___libc_atexit = .);
139 __libc_atexit : { *(__libc_atexit) }
140 PROVIDE(__stop___libc_atexit = .);
141 PROVIDE(__start___libc_IO_vtables = .);
142 __libc_IO_vtables : { *(__libc_IO_vtables) }
143 PROVIDE(__stop___libc_IO_vtables = .);
144 /DISCARD/ : { *(.gnu.glibc-stub.*) }
145 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
146 .dynamic : { *(.dynamic) }
147 .got : { *(.got) *(.igot) }
148 . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .);
149 .got.plt : { *(.got.plt) *(.igot.plt) }
152 *(.data .data.* .gnu.linkonce.d.*)
155 .data1 : { *(.data1) }
156 _edata = .; PROVIDE (edata = .);
162 PROVIDE(__start___libc_freeres_ptrs = .);
163 *(__libc_freeres_ptrs)
164 PROVIDE(__stop___libc_freeres_ptrs = .);
165 *(.bss .bss.* .gnu.linkonce.b.*)
167 /* Align here to ensure that the .bss section occupies space up to
168 _end. Align after .bss to ensure correct alignment even if the
169 .bss section disappears because there are no input sections.
170 FIXME: Why do we need it? When there is no .bss section, we don't
171 pad the .data section. */
172 . = ALIGN(. != 0 ? 64 / 8 : 1);
177 *(.lbss .lbss.* .gnu.linkonce.lb.*)
181 . = SEGMENT_START("ldata-segment", .);
182 .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
184 *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
186 .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
188 *(.ldata .ldata.* .gnu.linkonce.l.*)
189 . = ALIGN(. != 0 ? 64 / 8 : 1);
192 _end = .; PROVIDE (end = .);
193 . = DATA_SEGMENT_END (.);
194 /* Stabs debugging sections. */
195 .stab 0 : { *(.stab) }
196 .stabstr 0 : { *(.stabstr) }
197 .stab.excl 0 : { *(.stab.excl) }
198 .stab.exclstr 0 : { *(.stab.exclstr) }
199 .stab.index 0 : { *(.stab.index) }
200 .stab.indexstr 0 : { *(.stab.indexstr) }
201 .comment 0 : { *(.comment) }
202 /* DWARF debug sections.
203 Symbols in the DWARF debugging sections are relative to the beginning
204 of the section so we begin them at 0. */
206 .debug 0 : { *(.debug) }
207 .line 0 : { *(.line) }
208 /* GNU DWARF 1 extensions */
209 .debug_srcinfo 0 : { *(.debug_srcinfo) }
210 .debug_sfnames 0 : { *(.debug_sfnames) }
211 /* DWARF 1.1 and DWARF 2 */
212 .debug_aranges 0 : { *(.debug_aranges) }
213 .debug_pubnames 0 : { *(.debug_pubnames) }
215 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
216 .debug_abbrev 0 : { *(.debug_abbrev) }
217 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
218 .debug_frame 0 : { *(.debug_frame) }
219 .debug_str 0 : { *(.debug_str) }
220 .debug_loc 0 : { *(.debug_loc) }
221 .debug_macinfo 0 : { *(.debug_macinfo) }
222 /* SGI/MIPS DWARF 2 extensions */
223 .debug_weaknames 0 : { *(.debug_weaknames) }
224 .debug_funcnames 0 : { *(.debug_funcnames) }
225 .debug_typenames 0 : { *(.debug_typenames) }
226 .debug_varnames 0 : { *(.debug_varnames) }
228 .debug_pubtypes 0 : { *(.debug_pubtypes) }
229 .debug_ranges 0 : { *(.debug_ranges) }
230 /* DWARF Extension. */
231 .debug_macro 0 : { *(.debug_macro) }
232 .debug_addr 0 : { *(.debug_addr) }
233 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
234 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }