blob: 7f928723edebc1456e192bd1f7e4a36d4ecbeb14 [file] [log] [blame]
Andrew Hsieh665c16a2013-09-22 14:03:39 +08001/* Script for ld -r: link without relocation */
2OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
3 "elf64-x86-64")
4OUTPUT_ARCH(i386:x86-64)
5 /* For some reason, the Solaris linker makes bad executables
6 if gld -r is used and the intermediate file has sections starting
7 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
8 bug. But for now assigning the zero vmas works. */
9SECTIONS
10{
11 /* Read-only sections, merged into text segment: */
12 .interp 0 : { *(.interp) }
13 .note.gnu.build-id : { *(.note.gnu.build-id) }
14 .hash 0 : { *(.hash) }
15 .gnu.hash 0 : { *(.gnu.hash) }
16 .dynsym 0 : { *(.dynsym) }
17 .dynstr 0 : { *(.dynstr) }
18 .gnu.version 0 : { *(.gnu.version) }
19 .gnu.version_d 0: { *(.gnu.version_d) }
20 .gnu.version_r 0: { *(.gnu.version_r) }
21 .rela.init 0 : { *(.rela.init) }
22 .rela.text 0 : { *(.rela.text) }
23 .rela.fini 0 : { *(.rela.fini) }
24 .rela.rodata 0 : { *(.rela.rodata) }
25 .rela.data.rel.ro 0 : { *(.rela.data.rel.ro) }
26 .rela.data 0 : { *(.rela.data) }
27 .rela.tdata 0 : { *(.rela.tdata) }
28 .rela.tbss 0 : { *(.rela.tbss) }
29 .rela.ctors 0 : { *(.rela.ctors) }
30 .rela.dtors 0 : { *(.rela.dtors) }
31 .rela.got 0 : { *(.rela.got) }
32 .rela.bss 0 : { *(.rela.bss) }
33 .rela.ldata 0 : { *(.rela.ldata) }
34 .rela.lbss 0 : { *(.rela.lbss) }
35 .rela.lrodata 0 : { *(.rela.lrodata) }
36 .rela.ifunc 0 : { *(.rela.ifunc) }
37 .rela.plt 0 :
38 {
39 *(.rela.plt)
40 }
41 .init 0 :
42 {
43 KEEP (*(SORT_NONE(.init)))
44 }
45 .plt 0 : { *(.plt) *(.iplt) }
46 .text 0 :
47 {
48 *(.text .stub)
49 /* .gnu.warning sections are handled specially by elf32.em. */
50 *(.gnu.warning)
51 }
52 .fini 0 :
53 {
54 KEEP (*(SORT_NONE(.fini)))
55 }
56 .rodata 0 : { *(.rodata) }
57 .rodata1 0 : { *(.rodata1) }
58 .eh_frame_hdr : { *(.eh_frame_hdr) }
59 .eh_frame 0 : ONLY_IF_RO { KEEP (*(.eh_frame)) }
60 .gcc_except_table 0 : ONLY_IF_RO { *(.gcc_except_table
61 .gcc_except_table.*) }
62 /* These sections are generated by the Sun/Oracle C++ compiler. */
63 .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
64 .exception_ranges*) }
Andrew Hsieh515a3792014-02-06 16:01:03 +080065 /* Adjust the address for the data segment. For 32 bits we want to align
66 at exactly a page boundary to make life easier for apriori. */
Andrew Hsieh665c16a2013-09-22 14:03:39 +080067 /* Exception handling */
68 .eh_frame 0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
69 .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
70 .exception_ranges 0 : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
71 /* Thread Local Storage sections */
72 .tdata 0 : { *(.tdata) }
73 .tbss 0 : { *(.tbss) }
74 /* Ensure the __preinit_array_start label is properly aligned. We
75 could instead move the label definition inside the section, but
76 the linker would then create the section even if it turns out to
77 be empty, which isn't pretty. */
78 . = ALIGN(32 / 8);
79 .preinit_array 0 :
80 {
81 KEEP (*(.preinit_array))
82 }
83 .jcr 0 : { KEEP (*(.jcr)) }
84 .dynamic 0 : { *(.dynamic) }
85 .got 0 : { *(.got) *(.igot) }
86 .got.plt 0 : { *(.got.plt) *(.igot.plt) }
87 .data 0 :
88 {
89 *(.data)
90 }
91 .data1 0 : { *(.data1) }
92 .bss 0 :
93 {
94 *(.dynbss)
95 *(.bss)
96 *(COMMON)
97 /* Align here to ensure that the .bss section occupies space up to
98 _end. Align after .bss to ensure correct alignment even if the
99 .bss section disappears because there are no input sections. */
100 }
101 .lbss 0 :
102 {
103 *(.dynlbss)
104 *(.lbss)
105 *(LARGE_COMMON)
106 }
107 .lrodata 0 :
108 {
109 *(.lrodata)
110 }
111 .ldata 0 :
112 {
113 *(.ldata)
114 }
115 /* Stabs debugging sections. */
116 .stab 0 : { *(.stab) }
117 .stabstr 0 : { *(.stabstr) }
118 .stab.excl 0 : { *(.stab.excl) }
119 .stab.exclstr 0 : { *(.stab.exclstr) }
120 .stab.index 0 : { *(.stab.index) }
121 .stab.indexstr 0 : { *(.stab.indexstr) }
122 .comment 0 : { *(.comment) }
123 /* DWARF debug sections.
124 Symbols in the DWARF debugging sections are relative to the beginning
125 of the section so we begin them at 0. */
126 /* DWARF 1 */
127 .debug 0 : { *(.debug) }
128 .line 0 : { *(.line) }
129 /* GNU DWARF 1 extensions */
130 .debug_srcinfo 0 : { *(.debug_srcinfo) }
131 .debug_sfnames 0 : { *(.debug_sfnames) }
132 /* DWARF 1.1 and DWARF 2 */
133 .debug_aranges 0 : { *(.debug_aranges) }
134 .debug_pubnames 0 : { *(.debug_pubnames) }
135 /* DWARF 2 */
136 .debug_info 0 : { *(.debug_info) }
137 .debug_abbrev 0 : { *(.debug_abbrev) }
Andrew Hsiehe08fa7e2014-04-26 19:46:31 -0700138 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
Andrew Hsieh665c16a2013-09-22 14:03:39 +0800139 .debug_frame 0 : { *(.debug_frame) }
140 .debug_str 0 : { *(.debug_str) }
141 .debug_loc 0 : { *(.debug_loc) }
142 .debug_macinfo 0 : { *(.debug_macinfo) }
143 /* SGI/MIPS DWARF 2 extensions */
144 .debug_weaknames 0 : { *(.debug_weaknames) }
145 .debug_funcnames 0 : { *(.debug_funcnames) }
146 .debug_typenames 0 : { *(.debug_typenames) }
147 .debug_varnames 0 : { *(.debug_varnames) }
148 /* DWARF 3 */
149 .debug_pubtypes 0 : { *(.debug_pubtypes) }
150 .debug_ranges 0 : { *(.debug_ranges) }
151 /* DWARF Extension. */
152 .debug_macro 0 : { *(.debug_macro) }
153 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
154}