ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/ldscripts/linux-ppc.ld
Revision: 1.1
Committed: 2006-03-25T07:08:50Z (18 years, 7 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-19, HEAD
Log Message:
- add Linux/PPC linker script
- always relocate Basilisk II binary to 0x78048000 on MacOS X (including x86,
  to be tested later)

File Contents

# Content
1 /* Script for -z combreloc: combine and sort reloc sections */
2 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
3 OUTPUT_ARCH(powerpc:common)
4 ENTRY(_start)
5 SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib");
6 SECTIONS
7 {
8 /* Read-only sections, merged into text segment: */
9 . = 0x78048000 + SIZEOF_HEADERS;
10 .interp : { *(.interp) }
11 .hash : { *(.hash) }
12 .dynsym : { *(.dynsym) }
13 .dynstr : { *(.dynstr) }
14 .gnu.version : { *(.gnu.version) }
15 .gnu.version_d : { *(.gnu.version_d) }
16 .gnu.version_r : { *(.gnu.version_r) }
17 .rel.dyn :
18 {
19 *(.rel.init)
20 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
21 *(.rel.fini)
22 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
23 *(.rel.data.rel.ro*)
24 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
25 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
26 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
27 *(.rel.ctors)
28 *(.rel.dtors)
29 *(.rel.got)
30 *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
31 *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
32 *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
33 *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
34 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
35 }
36 .rela.dyn :
37 {
38 *(.rela.init)
39 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
40 *(.rela.fini)
41 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
42 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
43 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
44 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
45 *(.rela.ctors)
46 *(.rela.dtors)
47 *(.rela.got)
48 *(.rela.got1)
49 *(.rela.got2)
50 *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
51 *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
52 *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
53 *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
54 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
55 }
56 .rel.plt : { *(.rel.plt) }
57 .rela.plt : { *(.rela.plt) }
58 .init :
59 {
60 KEEP (*(.init))
61 } =0
62 .text :
63 {
64 *(.text .stub .text.* .gnu.linkonce.t.*)
65 KEEP (*(.text.*personality*))
66 /* .gnu.warning sections are handled specially by elf32.em. */
67 *(.gnu.warning)
68 } =0
69 .fini :
70 {
71 KEEP (*(.fini))
72 } =0
73 PROVIDE (__etext = .);
74 PROVIDE (_etext = .);
75 PROVIDE (etext = .);
76 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
77 .rodata1 : { *(.rodata1) }
78 .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
79 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
80 .eh_frame_hdr : { *(.eh_frame_hdr) }
81 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
82 .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
83 /* Adjust the address for the data segment. We want to adjust up to
84 the same address within the page on the next page up. */
85 . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
86 /* Exception handling */
87 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
88 .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
89 /* Thread Local Storage sections */
90 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
91 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
92 /* Ensure the __preinit_array_start label is properly aligned. We
93 could instead move the label definition inside the section, but
94 the linker would then create the section even if it turns out to
95 be empty, which isn't pretty. */
96 . = ALIGN(32 / 8);
97 PROVIDE (__preinit_array_start = .);
98 .preinit_array : { KEEP (*(.preinit_array)) }
99 PROVIDE (__preinit_array_end = .);
100 PROVIDE (__init_array_start = .);
101 .init_array : { KEEP (*(.init_array)) }
102 PROVIDE (__init_array_end = .);
103 PROVIDE (__fini_array_start = .);
104 .fini_array : { KEEP (*(.fini_array)) }
105 PROVIDE (__fini_array_end = .);
106 .ctors :
107 {
108 /* gcc uses crtbegin.o to find the start of
109 the constructors, so we make sure it is
110 first. Because this is a wildcard, it
111 doesn't matter if the user does not
112 actually link against crtbegin.o; the
113 linker won't look for a file to match a
114 wildcard. The wildcard also means that it
115 doesn't matter which directory crtbegin.o
116 is in. */
117 KEEP (*crtbegin*.o(.ctors))
118 /* We don't want to include the .ctor section from
119 from the crtend.o file until after the sorted ctors.
120 The .ctor section from the crtend file contains the
121 end of ctors marker and it must be last */
122 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
123 KEEP (*(SORT(.ctors.*)))
124 KEEP (*(.ctors))
125 }
126 .dtors :
127 {
128 KEEP (*crtbegin*.o(.dtors))
129 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
130 KEEP (*(SORT(.dtors.*)))
131 KEEP (*(.dtors))
132 }
133 .jcr : { KEEP (*(.jcr)) }
134 .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
135 .fixup : { *(.fixup) }
136 .got1 : { *(.got1) }
137 .got2 : { *(.got2) }
138 .dynamic : { *(.dynamic) }
139 . = DATA_SEGMENT_RELRO_END (0, .);
140 .data :
141 {
142 *(.data .data.* .gnu.linkonce.d.*)
143 KEEP (*(.gnu.linkonce.d.*personality*))
144 SORT(CONSTRUCTORS)
145 }
146 .data1 : { *(.data1) }
147 .got1 : { *(.got1) }
148 .got2 : { *(.got2) }
149 .got : { *(.got.plt) *(.got) }
150 /* We want the small data sections together, so single-instruction offsets
151 can access them all, and initialized data all before uninitialized, so
152 we can shorten the on-disk segment size. */
153 .sdata :
154 {
155 *(.sdata .sdata.* .gnu.linkonce.s.*)
156 }
157 _edata = .;
158 PROVIDE (edata = .);
159 __bss_start = .;
160 .sbss :
161 {
162 PROVIDE (__sbss_start = .);
163 PROVIDE (___sbss_start = .);
164 *(.dynsbss)
165 *(.sbss .sbss.* .gnu.linkonce.sb.*)
166 *(.scommon)
167 PROVIDE (__sbss_end = .);
168 PROVIDE (___sbss_end = .);
169 }
170 .plt : { *(.plt) }
171 .bss :
172 {
173 *(.dynbss)
174 *(.bss .bss.* .gnu.linkonce.b.*)
175 *(COMMON)
176 /* Align here to ensure that the .bss section occupies space up to
177 _end. Align after .bss to ensure correct alignment even if the
178 .bss section disappears because there are no input sections. */
179 . = ALIGN(32 / 8);
180 }
181 . = ALIGN(32 / 8);
182 _end = .;
183 PROVIDE (end = .);
184 . = DATA_SEGMENT_END (.);
185 /* Stabs debugging sections. */
186 .stab 0 : { *(.stab) }
187 .stabstr 0 : { *(.stabstr) }
188 .stab.excl 0 : { *(.stab.excl) }
189 .stab.exclstr 0 : { *(.stab.exclstr) }
190 .stab.index 0 : { *(.stab.index) }
191 .stab.indexstr 0 : { *(.stab.indexstr) }
192 .comment 0 : { *(.comment) }
193 /* DWARF debug sections.
194 Symbols in the DWARF debugging sections are relative to the beginning
195 of the section so we begin them at 0. */
196 /* DWARF 1 */
197 .debug 0 : { *(.debug) }
198 .line 0 : { *(.line) }
199 /* GNU DWARF 1 extensions */
200 .debug_srcinfo 0 : { *(.debug_srcinfo) }
201 .debug_sfnames 0 : { *(.debug_sfnames) }
202 /* DWARF 1.1 and DWARF 2 */
203 .debug_aranges 0 : { *(.debug_aranges) }
204 .debug_pubnames 0 : { *(.debug_pubnames) }
205 /* DWARF 2 */
206 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
207 .debug_abbrev 0 : { *(.debug_abbrev) }
208 .debug_line 0 : { *(.debug_line) }
209 .debug_frame 0 : { *(.debug_frame) }
210 .debug_str 0 : { *(.debug_str) }
211 .debug_loc 0 : { *(.debug_loc) }
212 .debug_macinfo 0 : { *(.debug_macinfo) }
213 /* SGI/MIPS DWARF 2 extensions */
214 .debug_weaknames 0 : { *(.debug_weaknames) }
215 .debug_funcnames 0 : { *(.debug_funcnames) }
216 .debug_typenames 0 : { *(.debug_typenames) }
217 .debug_varnames 0 : { *(.debug_varnames) }
218 /DISCARD/ : { *(.fixup) }
219 }