blob: 42acd737f270646b7b79db208c5463220057d7a2 [file] [log] [blame]
Andrew Hsieh02075082012-03-06 14:06:15 -08001/* 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("/tmp/ahsieh-gcc-64-X27190/2/x86_64-linux-glibc2.7-4.6/x86_64-linux/lib64"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); 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 (*(.init))
45 } =0x90909090
46 .plt : { *(.plt) *(.iplt) }
47 .text :
48 {
49 *(.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 } =0x90909090
57 .fini :
58 {
59 KEEP (*(.fini))
60 } =0x90909090
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 .gcc_except_table.*) }
69 /* Adjust the address for the data segment. We want to adjust up to
70 the same address within the page on the next page up. */
71 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
72 /* Exception handling */
73 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
74 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
75 /* Thread Local Storage sections */
76 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
77 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
78 .preinit_array :
79 {
80 KEEP (*(.preinit_array))
81 }
82 .init_array :
83 {
84 KEEP (*(SORT(.init_array.*)))
85 KEEP (*(.init_array))
86 }
87 .fini_array :
88 {
89 KEEP (*(SORT(.fini_array.*)))
90 KEEP (*(.fini_array))
91 }
92 .ctors :
93 {
94 /* gcc uses crtbegin.o to find the start of
95 the constructors, so we make sure it is
96 first. Because this is a wildcard, it
97 doesn't matter if the user does not
98 actually link against crtbegin.o; the
99 linker won't look for a file to match a
100 wildcard. The wildcard also means that it
101 doesn't matter which directory crtbegin.o
102 is in. */
103 KEEP (*crtbegin.o(.ctors))
104 KEEP (*crtbegin?.o(.ctors))
105 /* We don't want to include the .ctor section from
106 the crtend.o file until after the sorted ctors.
107 The .ctor section from the crtend file contains the
108 end of ctors marker and it must be last */
109 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
110 KEEP (*(SORT(.ctors.*)))
111 KEEP (*(.ctors))
112 }
113 .dtors :
114 {
115 KEEP (*crtbegin.o(.dtors))
116 KEEP (*crtbegin?.o(.dtors))
117 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
118 KEEP (*(SORT(.dtors.*)))
119 KEEP (*(.dtors))
120 }
121 .jcr : { KEEP (*(.jcr)) }
122 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
123 .dynamic : { *(.dynamic) }
124 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
125 . = DATA_SEGMENT_RELRO_END (0, .);
126 .data :
127 {
128 *(.data .data.* .gnu.linkonce.d.*)
129 SORT(CONSTRUCTORS)
130 }
131 .data1 : { *(.data1) }
132 _edata = .; PROVIDE (edata = .);
133 __bss_start = .;
134 .bss :
135 {
136 *(.dynbss)
137 *(.bss .bss.* .gnu.linkonce.b.*)
138 *(COMMON)
139 /* Align here to ensure that the .bss section occupies space up to
140 _end. Align after .bss to ensure correct alignment even if the
141 .bss section disappears because there are no input sections.
142 FIXME: Why do we need it? When there is no .bss section, we don't
143 pad the .data section. */
144 . = ALIGN(. != 0 ? 64 / 8 : 1);
145 }
146 .lbss :
147 {
148 *(.dynlbss)
149 *(.lbss .lbss.* .gnu.linkonce.lb.*)
150 *(LARGE_COMMON)
151 }
152 . = ALIGN(64 / 8);
153 .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
154 {
155 *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
156 }
157 .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
158 {
159 *(.ldata .ldata.* .gnu.linkonce.l.*)
160 . = ALIGN(. != 0 ? 64 / 8 : 1);
161 }
162 . = ALIGN(64 / 8);
163 _end = .; PROVIDE (end = .);
164 . = DATA_SEGMENT_END (.);
165 /* Stabs debugging sections. */
166 .stab 0 : { *(.stab) }
167 .stabstr 0 : { *(.stabstr) }
168 .stab.excl 0 : { *(.stab.excl) }
169 .stab.exclstr 0 : { *(.stab.exclstr) }
170 .stab.index 0 : { *(.stab.index) }
171 .stab.indexstr 0 : { *(.stab.indexstr) }
172 .comment 0 : { *(.comment) }
173 /* DWARF debug sections.
174 Symbols in the DWARF debugging sections are relative to the beginning
175 of the section so we begin them at 0. */
176 /* DWARF 1 */
177 .debug 0 : { *(.debug) }
178 .line 0 : { *(.line) }
179 /* GNU DWARF 1 extensions */
180 .debug_srcinfo 0 : { *(.debug_srcinfo .zdebug_srcinfo) }
181 .debug_sfnames 0 : { *(.debug_sfnames .zdebug_sfnames) }
182 /* DWARF 1.1 and DWARF 2 */
183 .debug_aranges 0 : { *(.debug_aranges .zdebug_aranges) }
184 .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) }
185 /* DWARF 2 */
186 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info) }
187 .debug_abbrev 0 : { *(.debug_abbrev .zdebug_abbrev) }
188 .debug_line 0 : { *(.debug_line .zdebug_line) }
189 .debug_frame 0 : { *(.debug_frame .zdebug_frame) }
190 .debug_str 0 : { *(.debug_str .zdebug_str) }
191 .debug_loc 0 : { *(.debug_loc .zdebug_loc) }
192 .debug_macinfo 0 : { *(.debug_macinfo .zdebug_macinfo) }
193 /* SGI/MIPS DWARF 2 extensions */
194 .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames) }
195 .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames) }
196 .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames) }
197 .debug_varnames 0 : { *(.debug_varnames .zdebug_varnames) }
198 /* DWARF 3 */
199 .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) }
200 .debug_ranges 0 : { *(.debug_ranges .zdebug_ranges) }
201 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
202 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
203}