blob: 86acf0aa4a8a9e1bd190c05157551f0a38cd6399 [file] [log] [blame]
Andrew Walbran52c29692019-10-21 16:51:38 +01001/* Script for ld -Ur: link w/out relocation, do create constructors */
2/* Copyright (C) 2014-2016 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. */
6OUTPUT_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) }
59 .eh_frame_hdr : { *(.eh_frame_hdr) }
60 .eh_frame 0 : ONLY_IF_RO { KEEP (*(.eh_frame)) }
61 .gcc_except_table 0 : ONLY_IF_RO { *(.gcc_except_table
62 .gcc_except_table.*) }
63 .gnu_extab 0 : ONLY_IF_RO { *(.gnu_extab*) }
64 /* These sections are generated by the Sun/Oracle C++ compiler. */
65 .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
66 .exception_ranges*) }
67 /* 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. */
69 /* Exception handling */
70 .eh_frame 0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
71 .gnu_extab 0 : ONLY_IF_RW { *(.gnu_extab) }
72 .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 SORT(CONSTRUCTORS)
89 }
90 .data1 0 : { *(.data1) }
91 .bss 0 :
92 {
93 *(.dynbss)
94 *(.bss)
95 *(COMMON)
96 /* Align here to ensure that the .bss section occupies space up to
97 _end. Align after .bss to ensure correct alignment even if the
98 .bss section disappears because there are no input sections.
99 FIXME: Why do we need it? When there is no .bss section, we don't
100 pad the .data section. */
101 }
102 /* Stabs debugging sections. */
103 .stab 0 : { *(.stab) }
104 .stabstr 0 : { *(.stabstr) }
105 .stab.excl 0 : { *(.stab.excl) }
106 .stab.exclstr 0 : { *(.stab.exclstr) }
107 .stab.index 0 : { *(.stab.index) }
108 .stab.indexstr 0 : { *(.stab.indexstr) }
109 .comment 0 : { *(.comment) }
110 /* DWARF debug sections.
111 Symbols in the DWARF debugging sections are relative to the beginning
112 of the section so we begin them at 0. */
113 /* DWARF 1 */
114 .debug 0 : { *(.debug) }
115 .line 0 : { *(.line) }
116 /* GNU DWARF 1 extensions */
117 .debug_srcinfo 0 : { *(.debug_srcinfo) }
118 .debug_sfnames 0 : { *(.debug_sfnames) }
119 /* DWARF 1.1 and DWARF 2 */
120 .debug_aranges 0 : { *(.debug_aranges) }
121 .debug_pubnames 0 : { *(.debug_pubnames) }
122 /* DWARF 2 */
123 .debug_info 0 : { *(.debug_info) }
124 .debug_abbrev 0 : { *(.debug_abbrev) }
125 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
126 .debug_frame 0 : { *(.debug_frame) }
127 .debug_str 0 : { *(.debug_str) }
128 .debug_loc 0 : { *(.debug_loc) }
129 .debug_macinfo 0 : { *(.debug_macinfo) }
130 /* SGI/MIPS DWARF 2 extensions */
131 .debug_weaknames 0 : { *(.debug_weaknames) }
132 .debug_funcnames 0 : { *(.debug_funcnames) }
133 .debug_typenames 0 : { *(.debug_typenames) }
134 .debug_varnames 0 : { *(.debug_varnames) }
135 /* DWARF 3 */
136 .debug_pubtypes 0 : { *(.debug_pubtypes) }
137 .debug_ranges 0 : { *(.debug_ranges) }
138 /* DWARF Extension. */
139 .debug_macro 0 : { *(.debug_macro) }
140 .debug_addr 0 : { *(.debug_addr) }
141 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
142 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
143}