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