blob: 277410b93a33b8cc7d52d67e96183ef4e4a6a622 [file] [log] [blame]
Ben Cheng7823f2a2014-04-08 14:53:42 -07001/* Script for ld -r: link without relocation */
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -07002/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
Rong Xue1a8a482015-04-08 12:48:42 -07003 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("elf64-bigaarch64", "elf64-bigaarch64",
7 "elf64-littleaarch64")
8OUTPUT_ARCH(aarch64)
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 .rela.init 0 : { *(.rela.init) }
26 .rela.text 0 : { *(.rela.text) }
27 .rela.fini 0 : { *(.rela.fini) }
28 .rela.rodata 0 : { *(.rela.rodata) }
29 .rela.data.rel.ro 0 : { *(.rela.data.rel.ro) }
30 .rela.data 0 : { *(.rela.data) }
31 .rela.tdata 0 : { *(.rela.tdata) }
32 .rela.tbss 0 : { *(.rela.tbss) }
33 .rela.ctors 0 : { *(.rela.ctors) }
34 .rela.dtors 0 : { *(.rela.dtors) }
35 .rela.got 0 : { *(.rela.got) }
36 .rela.bss 0 : { *(.rela.bss) }
37 .rela.ifunc 0 : { *(.rela.ifunc) }
38 .rela.plt 0 :
39 {
40 *(.rela.plt)
41 }
42 .init 0 :
43 {
44 KEEP (*(SORT_NONE(.init)))
45 } =0
46 .plt 0 : ALIGN(16) { *(.plt) *(.iplt) }
47 .text 0 :
48 {
49 *(.text .stub)
50 /* .gnu.warning sections are handled specially by elf32.em. */
51 *(.gnu.warning)
52 } =0
53 .fini 0 :
54 {
55 KEEP (*(SORT_NONE(.fini)))
56 } =0
57 .rodata 0 : { *(.rodata) }
58 .rodata1 0 : { *(.rodata1) }
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -070059 .eh_frame_hdr : { *(.eh_frame_hdr) }
60 .eh_frame 0 : ONLY_IF_RO { KEEP (*(.eh_frame)) }
Ben Cheng7823f2a2014-04-08 14:53:42 -070061 .gcc_except_table 0 : ONLY_IF_RO { *(.gcc_except_table
62 .gcc_except_table.*) }
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -070063 .gnu_extab 0 : ONLY_IF_RO { *(.gnu_extab*) }
Ben Cheng7823f2a2014-04-08 14:53:42 -070064 /* These sections are generated by the Sun/Oracle C++ compiler. */
65 .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
66 .exception_ranges*) }
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -070067 /* Adjust the address for the data segment. We want to adjust up to
68 the same address within the page on the next page up. */
Ben Cheng7823f2a2014-04-08 14:53:42 -070069 /* Exception handling */
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -070070 .eh_frame 0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
71 .gnu_extab 0 : ONLY_IF_RW { *(.gnu_extab) }
Ben Cheng7823f2a2014-04-08 14:53:42 -070072 .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
73 .exception_ranges 0 : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
74 /* Thread Local Storage sections */
75 .tdata 0 : { *(.tdata) }
76 .tbss 0 : { *(.tbss) }
77 .preinit_array 0 :
78 {
79 KEEP (*(.preinit_array))
80 }
81 .jcr 0 : { KEEP (*(.jcr)) }
82 .dynamic 0 : { *(.dynamic) }
83 .got 0 : { *(.got) *(.igot) }
84 .got.plt 0 : { *(.got.plt) *(.igot.plt) }
85 .data 0 :
86 {
87 *(.data)
88 }
89 .data1 0 : { *(.data1) }
90 .bss 0 :
91 {
92 *(.dynbss)
93 *(.bss)
94 *(COMMON)
95 /* Align here to ensure that the .bss section occupies space up to
96 _end. Align after .bss to ensure correct alignment even if the
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -070097 .bss section disappears because there are no input sections.
98 FIXME: Why do we need it? When there is no .bss section, we don't
99 pad the .data section. */
Ben Cheng7823f2a2014-04-08 14:53:42 -0700100 }
101 /* Stabs debugging sections. */
102 .stab 0 : { *(.stab) }
103 .stabstr 0 : { *(.stabstr) }
104 .stab.excl 0 : { *(.stab.excl) }
105 .stab.exclstr 0 : { *(.stab.exclstr) }
106 .stab.index 0 : { *(.stab.index) }
107 .stab.indexstr 0 : { *(.stab.indexstr) }
108 .comment 0 : { *(.comment) }
109 /* DWARF debug sections.
110 Symbols in the DWARF debugging sections are relative to the beginning
111 of the section so we begin them at 0. */
112 /* DWARF 1 */
113 .debug 0 : { *(.debug) }
114 .line 0 : { *(.line) }
115 /* GNU DWARF 1 extensions */
116 .debug_srcinfo 0 : { *(.debug_srcinfo) }
117 .debug_sfnames 0 : { *(.debug_sfnames) }
118 /* DWARF 1.1 and DWARF 2 */
119 .debug_aranges 0 : { *(.debug_aranges) }
120 .debug_pubnames 0 : { *(.debug_pubnames) }
121 /* DWARF 2 */
122 .debug_info 0 : { *(.debug_info) }
123 .debug_abbrev 0 : { *(.debug_abbrev) }
124 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
125 .debug_frame 0 : { *(.debug_frame) }
126 .debug_str 0 : { *(.debug_str) }
127 .debug_loc 0 : { *(.debug_loc) }
128 .debug_macinfo 0 : { *(.debug_macinfo) }
129 /* SGI/MIPS DWARF 2 extensions */
130 .debug_weaknames 0 : { *(.debug_weaknames) }
131 .debug_funcnames 0 : { *(.debug_funcnames) }
132 .debug_typenames 0 : { *(.debug_typenames) }
133 .debug_varnames 0 : { *(.debug_varnames) }
134 /* DWARF 3 */
135 .debug_pubtypes 0 : { *(.debug_pubtypes) }
136 .debug_ranges 0 : { *(.debug_ranges) }
137 /* DWARF Extension. */
138 .debug_macro 0 : { *(.debug_macro) }
Rahul Chaudhry2d4cbf62017-09-18 10:30:53 -0700139 .debug_addr 0 : { *(.debug_addr) }
Ben Cheng7823f2a2014-04-08 14:53:42 -0700140 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
141 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
142}