Commit 85a6f129250efde1fe0af91a981d5006a0646b96
1 parent
9957427e
Update ppc.ld to work with newer binutils.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2734 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
156 additions
and
68 deletions
ppc.ld
@@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; | 2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; |
3 | */ | 3 | */ |
4 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") | 4 | OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") |
5 | -OUTPUT_ARCH(powerpc) | ||
6 | -SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/alpha-unknown-linux-gnu/lib); | 5 | +OUTPUT_ARCH(powerpc:common) |
6 | +SEARCH_DIR(/usr/powerpc-linux-gnu/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib) | ||
7 | ENTRY(_start) | 7 | ENTRY(_start) |
8 | SECTIONS | 8 | SECTIONS |
9 | { | 9 | { |
@@ -16,93 +16,179 @@ SECTIONS | @@ -16,93 +16,179 @@ SECTIONS | ||
16 | .gnu.version : { *(.gnu.version) } | 16 | .gnu.version : { *(.gnu.version) } |
17 | .gnu.version_d : { *(.gnu.version_d) } | 17 | .gnu.version_d : { *(.gnu.version_d) } |
18 | .gnu.version_r : { *(.gnu.version_r) } | 18 | .gnu.version_r : { *(.gnu.version_r) } |
19 | - .rel.text : | ||
20 | - { *(.rel.text) *(.rel.gnu.linkonce.t*) } | ||
21 | - .rela.text : | ||
22 | - { *(.rela.text) *(.rela.gnu.linkonce.t*) } | ||
23 | - .rel.data : | ||
24 | - { *(.rel.data) *(.rel.gnu.linkonce.d*) } | ||
25 | - .rela.data : | ||
26 | - { *(.rela.data) *(.rela.gnu.linkonce.d*) } | ||
27 | - .rel.rodata : | ||
28 | - { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } | ||
29 | - .rela.rodata : | ||
30 | - { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } | ||
31 | - .rel.got : { *(.rel.got) } | ||
32 | - .rela.got : { *(.rela.got) } | ||
33 | - .rel.ctors : { *(.rel.ctors) } | ||
34 | - .rela.ctors : { *(.rela.ctors) } | ||
35 | - .rel.dtors : { *(.rel.dtors) } | ||
36 | - .rela.dtors : { *(.rela.dtors) } | ||
37 | - .rel.init : { *(.rel.init) } | ||
38 | - .rela.init : { *(.rela.init) } | ||
39 | - .rel.fini : { *(.rel.fini) } | ||
40 | - .rela.fini : { *(.rela.fini) } | ||
41 | - .rel.bss : { *(.rel.bss) } | ||
42 | - .rela.bss : { *(.rela.bss) } | ||
43 | - .rel.plt : { *(.rel.plt) } | ||
44 | - .rela.plt : { *(.rela.plt) } | ||
45 | - .init : { *(.init) } =0x47ff041f | ||
46 | - .text : | 19 | + .rel.init : { *(.rel.init) } |
20 | + .rela.init : { *(.rela.init) } | ||
21 | + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } | ||
22 | + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } | ||
23 | + .rel.fini : { *(.rel.fini) } | ||
24 | + .rela.fini : { *(.rela.fini) } | ||
25 | + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } | ||
26 | + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } | ||
27 | + .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } | ||
28 | + .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } | ||
29 | + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } | ||
30 | + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } | ||
31 | + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } | ||
32 | + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } | ||
33 | + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } | ||
34 | + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } | ||
35 | + .rel.ctors : { *(.rel.ctors) } | ||
36 | + .rela.ctors : { *(.rela.ctors) } | ||
37 | + .rel.dtors : { *(.rel.dtors) } | ||
38 | + .rela.dtors : { *(.rela.dtors) } | ||
39 | + .rel.got : { *(.rel.got) } | ||
40 | + .rela.got : { *(.rela.got) } | ||
41 | + .rela.got1 : { *(.rela.got1) } | ||
42 | + .rela.got2 : { *(.rela.got2) } | ||
43 | + .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } | ||
44 | + .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } | ||
45 | + .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } | ||
46 | + .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } | ||
47 | + .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } | ||
48 | + .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } | ||
49 | + .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } | ||
50 | + .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } | ||
51 | + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } | ||
52 | + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } | ||
53 | + .rel.plt : { *(.rel.plt) } | ||
54 | + .rela.plt : { *(.rela.plt) } | ||
55 | + .init : | ||
47 | { | 56 | { |
48 | - *(.text) | 57 | + KEEP (*(.init)) |
58 | + } =0 | ||
59 | + .text : | ||
60 | + { | ||
61 | + *(.text .stub .text.* .gnu.linkonce.t.*) | ||
62 | + KEEP (*(.text.*personality*)) | ||
49 | /* .gnu.warning sections are handled specially by elf32.em. */ | 63 | /* .gnu.warning sections are handled specially by elf32.em. */ |
50 | *(.gnu.warning) | 64 | *(.gnu.warning) |
51 | - *(.gnu.linkonce.t*) | 65 | + *(.glink) |
66 | + } =0x47ff041f | ||
67 | + .fini : | ||
68 | + { | ||
69 | + KEEP (*(.fini)) | ||
52 | } =0x47ff041f | 70 | } =0x47ff041f |
53 | - _etext = .; | 71 | + PROVIDE (__etext = .); |
72 | + PROVIDE (_etext = .); | ||
54 | PROVIDE (etext = .); | 73 | PROVIDE (etext = .); |
55 | - .fini : { *(.fini) } =0x47ff041f | ||
56 | - . = ALIGN(32 / 8); | ||
57 | - PROVIDE (__preinit_array_start = .); | ||
58 | - .preinit_array : { *(.preinit_array) } | ||
59 | - PROVIDE (__preinit_array_end = .); | ||
60 | - PROVIDE (__init_array_start = .); | ||
61 | - .init_array : { *(.init_array) } | ||
62 | - PROVIDE (__init_array_end = .); | ||
63 | - PROVIDE (__fini_array_start = .); | ||
64 | - .fini_array : { *(.fini_array) } | ||
65 | - PROVIDE (__fini_array_end = .); | ||
66 | - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } | ||
67 | - .rodata1 : { *(.rodata1) } | ||
68 | - .reginfo : { *(.reginfo) } | 74 | + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } |
75 | + .rodata1 : { *(.rodata1) } | ||
76 | + .sdata2 : | ||
77 | + { | ||
78 | + PROVIDE (_SDA2_BASE_ = 32768); | ||
79 | + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) | ||
80 | + } | ||
81 | + .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } | ||
82 | + .eh_frame_hdr : { *(.eh_frame_hdr) } | ||
83 | + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } | ||
84 | + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } | ||
69 | /* Adjust the address for the data segment. We want to adjust up to | 85 | /* Adjust the address for the data segment. We want to adjust up to |
70 | the same address within the page on the next page up. */ | 86 | the same address within the page on the next page up. */ |
71 | - . = ALIGN(0x100000) + (. & (0x100000 - 1)); | ||
72 | - .data : | 87 | + . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000); |
88 | + /* Exception handling */ | ||
89 | + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } | ||
90 | + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } | ||
91 | + /* Thread Local Storage sections */ | ||
92 | + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } | ||
93 | + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } | ||
94 | + .preinit_array : | ||
95 | + { | ||
96 | + PROVIDE_HIDDEN (__preinit_array_start = .); | ||
97 | + KEEP (*(.preinit_array)) | ||
98 | + PROVIDE_HIDDEN (__preinit_array_end = .); | ||
99 | + } | ||
100 | + .init_array : | ||
101 | + { | ||
102 | + PROVIDE_HIDDEN (__init_array_start = .); | ||
103 | + KEEP (*(SORT(.init_array.*))) | ||
104 | + KEEP (*(.init_array)) | ||
105 | + PROVIDE_HIDDEN (__init_array_end = .); | ||
106 | + } | ||
107 | + .fini_array : | ||
108 | + { | ||
109 | + PROVIDE_HIDDEN (__fini_array_start = .); | ||
110 | + KEEP (*(.fini_array)) | ||
111 | + KEEP (*(SORT(.fini_array.*))) | ||
112 | + PROVIDE_HIDDEN (__fini_array_end = .); | ||
113 | + } | ||
114 | + .ctors : | ||
73 | { | 115 | { |
74 | - *(.data) | ||
75 | - *(.gnu.linkonce.d*) | ||
76 | - CONSTRUCTORS | 116 | + /* gcc uses crtbegin.o to find the start of |
117 | + the constructors, so we make sure it is | ||
118 | + first. Because this is a wildcard, it | ||
119 | + doesn't matter if the user does not | ||
120 | + actually link against crtbegin.o; the | ||
121 | + linker won't look for a file to match a | ||
122 | + wildcard. The wildcard also means that it | ||
123 | + doesn't matter which directory crtbegin.o | ||
124 | + is in. */ | ||
125 | + KEEP (*crtbegin*.o(.ctors)) | ||
126 | + /* We don't want to include the .ctor section from | ||
127 | + the crtend.o file until after the sorted ctors. | ||
128 | + The .ctor section from the crtend file contains the | ||
129 | + end of ctors marker and it must be last */ | ||
130 | + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) | ||
131 | + KEEP (*(SORT(.ctors.*))) | ||
132 | + KEEP (*(.ctors)) | ||
77 | } | 133 | } |
78 | - .data1 : { *(.data1) } | ||
79 | - .ctors : | 134 | + .dtors : |
80 | { | 135 | { |
81 | - *(.ctors) | 136 | + KEEP (*crtbegin*.o(.dtors)) |
137 | + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) | ||
138 | + KEEP (*(SORT(.dtors.*))) | ||
139 | + KEEP (*(.dtors)) | ||
82 | } | 140 | } |
83 | - .dtors : | 141 | + .jcr : { KEEP (*(.jcr)) } |
142 | + .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } | ||
143 | + .got1 : { *(.got1) } | ||
144 | + .got2 : { *(.got2) } | ||
145 | + .dynamic : { *(.dynamic) } | ||
146 | + .got : SPECIAL { *(.got) } | ||
147 | + . = DATA_SEGMENT_RELRO_END (0, .); | ||
148 | + .plt : SPECIAL { *(.plt) } | ||
149 | + .data : | ||
84 | { | 150 | { |
85 | - *(.dtors) | 151 | + *(.data .data.* .gnu.linkonce.d.*) |
152 | + KEEP (*(.gnu.linkonce.d.*personality*)) | ||
153 | + SORT(CONSTRUCTORS) | ||
86 | } | 154 | } |
87 | - .plt : { *(.plt) } | ||
88 | - .got : { *(.got.plt) *(.got) } | ||
89 | - .dynamic : { *(.dynamic) } | 155 | + .data1 : { *(.data1) } |
156 | + .got : SPECIAL { *(.got) } | ||
90 | /* We want the small data sections together, so single-instruction offsets | 157 | /* We want the small data sections together, so single-instruction offsets |
91 | can access them all, and initialized data all before uninitialized, so | 158 | can access them all, and initialized data all before uninitialized, so |
92 | we can shorten the on-disk segment size. */ | 159 | we can shorten the on-disk segment size. */ |
93 | - .sdata : { *(.sdata) } | ||
94 | - _edata = .; | ||
95 | - PROVIDE (edata = .); | 160 | + .sdata : |
161 | + { | ||
162 | + PROVIDE (_SDA_BASE_ = 32768); | ||
163 | + *(.sdata .sdata.* .gnu.linkonce.s.*) | ||
164 | + } | ||
165 | + _edata = .; PROVIDE (edata = .); | ||
96 | __bss_start = .; | 166 | __bss_start = .; |
97 | - .sbss : { *(.sbss) *(.scommon) } | ||
98 | - .bss : | 167 | + .sbss : |
168 | + { | ||
169 | + PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); | ||
170 | + *(.dynsbss) | ||
171 | + *(.sbss .sbss.* .gnu.linkonce.sb.*) | ||
172 | + *(.scommon) | ||
173 | + PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); | ||
174 | + } | ||
175 | + .plt : SPECIAL { *(.plt) } | ||
176 | + .bss : | ||
99 | { | 177 | { |
100 | *(.dynbss) | 178 | *(.dynbss) |
101 | - *(.bss) | 179 | + *(.bss .bss.* .gnu.linkonce.b.*) |
102 | *(COMMON) | 180 | *(COMMON) |
181 | + /* Align here to ensure that the .bss section occupies space up to | ||
182 | + _end. Align after .bss to ensure correct alignment even if the | ||
183 | + .bss section disappears because there are no input sections. | ||
184 | + FIXME: Why do we need it? When there is no .bss section, we don't | ||
185 | + pad the .data section. */ | ||
186 | + . = ALIGN(. != 0 ? 32 / 8 : 1); | ||
103 | } | 187 | } |
104 | - _end = . ; | ||
105 | - PROVIDE (end = .); | 188 | + . = ALIGN(32 / 8); |
189 | + . = ALIGN(32 / 8); | ||
190 | + _end = .; PROVIDE (end = .); | ||
191 | + . = DATA_SEGMENT_END (.); | ||
106 | /* Stabs debugging sections. */ | 192 | /* Stabs debugging sections. */ |
107 | .stab 0 : { *(.stab) } | 193 | .stab 0 : { *(.stab) } |
108 | .stabstr 0 : { *(.stabstr) } | 194 | .stabstr 0 : { *(.stabstr) } |
@@ -137,4 +223,6 @@ SECTIONS | @@ -137,4 +223,6 @@ SECTIONS | ||
137 | .debug_typenames 0 : { *(.debug_typenames) } | 223 | .debug_typenames 0 : { *(.debug_typenames) } |
138 | .debug_varnames 0 : { *(.debug_varnames) } | 224 | .debug_varnames 0 : { *(.debug_varnames) } |
139 | /* These must appear regardless of . */ | 225 | /* These must appear regardless of . */ |
226 | + /DISCARD/ : { *(.fixup) } | ||
227 | + /DISCARD/ : { *(.note.GNU-stack) } | ||
140 | } | 228 | } |