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