blob: ec4a4f2d721294e525465924888ab0f499a894ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
# Expect script for ld-powerpc tests
# Copyright (C) 2002-2016 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
if { ![istarget "powerpc*-*-*"] } {
return
}
if {[istarget "*-*-vxworks"]} {
set ppcvxtests {
{"VxWorks shared library test 1 (default script)" "-shared" ""
"-mregnames" {vxworks1-lib.s}
{{readelf --segments vxworks1-lib.sd}}
"libvxworks1.so"}
{"VxWorks shared library test 1" "-shared -Tvxworks1.ld" ""
"-mregnames" {vxworks1-lib.s}
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
{readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
"libvxworks1.so"}
{"VxWorks executable test 1 (dynamic)" \
"tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" ""
"-mregnames" {vxworks1.s}
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
"vxworks1"}
{"VxWorks executable test 2 (dynamic)" \
"-Tvxworks1.ld -q --force-dynamic" ""
"-mregnames" {vxworks2.s}
{{readelf --segments vxworks2.sd}}
"vxworks2"}
{"VxWorks executable test 2 (static)"
"-Tvxworks1.ld" ""
"-mregnames" {vxworks2.s}
{{readelf --segments vxworks2-static.sd}}
"vxworks2"}
{"VxWorks relax test"
"-Tvxworks1.ld --relax -q" ""
"-mregnames" {vxworks-relax.s}
{{readelf --relocs vxworks-relax.rd}}
"vxworks-relax"}
{"VxWorks relocatable relax test"
"-Tvxworks1.ld -r --relax -q" ""
"-mregnames" {vxworks-relax-2.s}
{{readelf --relocs vxworks-relax-2.rd}}
"vxworks-relax-2"}
}
run_ld_link_tests $ppcvxtests
run_dump_test "vxworks1-static"
return
}
# powerpc ELF only at the moment. Disable for nto too, even though it
# is ELF, because we pass -melf32ppc to ld and powerpc-nto-ld wants
# -melf32ppcnto.
if { [istarget "*-*-macos*"] || [istarget "*-*-netware*"]
|| [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
|| [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
|| [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]
|| [istarget "*-*-nto*"] } {
return
}
proc supports_ppc64 { } {
global ld
catch "exec $ld --help | grep emulations" tmp
if [ regexp "elf64l?ppc" $tmp ] then {
return 1
} else {
return 0
}
}
# List contains test-items with 3 items followed by 2 lists:
# 0:name 1:ld early options 2:ld late options 3:assembler options
# 4:filenames of assembler files 5: action and options. 6: name of output file
# Actions:
# objdump: Apply objdump options on result. Compare with regex (last arg).
# nm: Apply nm options on result. Compare with regex (last arg).
# readelf: Apply readelf options on result. Compare with regex (last arg).
set ppcelftests {
{"Reloc section order" "-melf32ppc -shared -z nocombreloc" "" "-a32" {reloc.s}
{{objdump -hw reloc.d}} "reloc.so"}
{"APUinfo section processing" "-melf32ppc" ""
"-a32 -me500" {apuinfo1.s apuinfo-nul.s apuinfo2.s}
{{readelf -x2 apuinfo.rd}} "apuinfo"}
{"APUinfo VLE section processing" "-melf32ppc" ""
"-a32 -me500 -mvle" {apuinfo1.s apuinfo-vle.s apuinfo2.s}
{{readelf -x2 apuinfo-vle.rd}} "apuinfo-vle"}
{"APUinfo NULL section processing" "-melf32ppc" ""
"-a32 -me500" {apuinfo-nul1.s apuinfo-nul.s}
{{readelf -x2 apuinfo-nul.rd}} "apuinfo"}
{"TLS32 static exec" "-melf32ppc" "" "-a32" {tls32.s tlslib32.s}
{{objdump -dr tls32.d} {objdump -sj.got tls32.g}
{objdump -sj.tdata tls32.t}}
"tls32"}
{"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" "" {}
{} "libtlslib32.so"}
{"TLS32 dynamic exec" "-melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {}
{{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d}
{objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}}
"tlsexe32"}
{"TLS32 shared" "-shared -melf32ppc --no-ld-generated-unwind-info tmpdir/tls32.o" "" "" {}
{{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d}
{objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}}
"tls32.so"}
{"TLS32 markers" "-melf32ppc" "" "-a32" {tlsmark32.s tlslib32.s}
{{objdump -dr tlsmark32.d}}
"tlsmark32"}
{"TLS32 opt 1" "-melf32ppc" "" "-a32" {tlsopt1_32.s tlslib32.s}
{{objdump -dr tlsopt1_32.d}}
"tlsopt1_32"}
{"TLS32 opt 2" "-melf32ppc" "" "-a32" {tlsopt2_32.s tlslib32.s}
{{objdump -dr tlsopt2_32.d}}
"tlsopt2_32"}
{"TLS32 opt 3" "-melf32ppc" "" "-a32" {tlsopt3_32.s tlslib32.s}
{{objdump -dr tlsopt3_32.d}}
"tlsopt3_32"}
{"TLS32 opt 4" "-melf32ppc" "" "-a32" {tlsopt4_32.s tlslib32.s}
{{objdump -dr tlsopt4_32.d}}
"tlsopt4_32"}
{"Shared library with global symbol" "-shared -melf32ppc" "" "-a32" {sdalib.s}
{} "sdalib.so"}
{"Dynamic application with SDA" "-melf32ppc tmpdir/sdalib.so" "" "-a32" {sdadyn.s}
{{objdump -R sdadyn.d}} "sdadyn"}
{"relaxing" "-melf32ppc --relax -Ttext=0 --defsym far=0x80001234 --defsym near=0x00004320" "" "-a32" "relax.s"
{{objdump -dr relax.d}}
"relax"}
{"relocatable relaxing" "-melf32ppc -r --relax" "" "-a32" "relax.s"
{{objdump -dr relaxr.d}}
"relax"}
}
set ppc64elftests {
{"TLS static exec" "-melf64ppc" "" "-a64" {tls.s tlslib.s}
{{objdump -dr tls.d} {objdump -sj.got tls.g} {objdump -sj.tdata tls.t}}
"tls"}
{"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" "" {}
{} "libtlslib.so"}
{"TLS helper old shared lib" "-shared -melf64ppc" "" "-a64" {oldtlslib.s}
{} "liboldlib.so"}
{"TLS dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/libtlslib.so" "" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexe"}
{"TLS dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o tmpdir/liboldlib.so" "" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexeold"}
{"TLS shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tls.o" "" "" {}
{{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
{objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
"tls.so"}
{"TLSTOC static exec" "-melf64ppc tmpdir/tlslib.o " "" "-a64" {tlstoc.s}
{{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g}
{objdump -sj.tdata tlstoc.t}}
"tlstoc"}
{"TLSTOC dynamic exec" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/libtlslib.so" ""
"" {}
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetoc"}
{"TLSTOC dynamic old" "-melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o tmpdir/liboldlib.so" ""
"" {}
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetocold"}
{"TLSTOC shared" "-shared -melf64ppc --no-ld-generated-unwind-info tmpdir/tlstoc.o" "" "" {}
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
"tlstoc.so"}
{"TLS markers" "-melf64ppc" "" "-a64" {tlsmark.s tlslib.s}
{{objdump -dr tlsmark.d}}
"tlsmark"}
{"TLS opt 1" "-melf64ppc" "" "-a64" {tlsopt1.s tlslib.s}
{{objdump -dr tlsopt1.d}}
"tlsopt1"}
{"TLS opt 2" "-melf64ppc" "" "-a64" {tlsopt2.s tlslib.s}
{{objdump -dr tlsopt2.d}}
"tlsopt2"}
{"TLS opt 3" "-melf64ppc" "" "-a64" {tlsopt3.s tlslib.s}
{{objdump -dr tlsopt3.d}}
"tlsopt3"}
{"TLS opt 4" "-melf64ppc" "" "-a64" {tlsopt4.s tlslib.s}
{{objdump -dr tlsopt4.d}}
"tlsopt4"}
{"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s}
{{objdump -dj.data symtocbase.d}} "symtocbase.so"}
{"TOC opt" "-melf64ppc" "" "-a64" {tocopt.s}
{{ld tocopt.out} {objdump -s tocopt.d}} "tocopt"}
{"TOC opt2" "-melf64ppc --defsym x=2" "" "-a64" {tocopt2.s}
{{ld tocopt2.out} {objdump -s tocopt2.d}} "tocopt2"}
{"TOC opt3" "-melf64ppc -no-keep-memory --defsym x=2" "" "-a64" {tocopt3.s}
{{objdump -s tocopt3.d}} "tocopt3"}
{"TOC opt4" "-melf64ppc -no-keep-memory --defsym x=2" "" "-a64"
{tocopt4a.s tocopt4b.s} {{objdump -s tocopt4.d}} "tocopt4"}
{"TOC opt5" "-melf64ppc" "" "-a64" {tocopt5.s}
{{objdump -s tocopt5.d}} "tocopt5"}
{"TOC opt6" "-melf64ppc" "" "-a64" {tocopt6a.s tocopt6b.s tocopt6c.s}
{{objdump -d tocopt6.d}} "tocopt6"}
{"ambig shared v1" "-shared -melf64ppc" "" "-a64" {funv1.s} {} "funv1.so"}
{"ambig shared v2" "-shared -melf64ppc" "" "-a64" {funv2.s} {} "funv2.so"}
}
set ppceabitests {
{"VLE multiple segments 1" "-T vle-multiseg-1.ld" ""
"-mregnames -mvle" {vle-multiseg.s}
{{readelf "-l" vle-multiseg-1.d}} "vle-multiseg-1"}
{"VLE multiple segments 2" "-T vle-multiseg-2.ld" ""
"-mregnames -mvle" {vle-multiseg.s}
{{readelf "-l" vle-multiseg-2.d}} "vle-multiseg-2"}
{"VLE multiple segments 3" "-T vle-multiseg-3.ld" ""
"-mregnames -mvle" {vle-multiseg.s}
{{readelf "-l" vle-multiseg-3.d}} "vle-multiseg-3"}
{"VLE multiple segments 4" "-T vle-multiseg-4.ld" ""
"-mregnames -mvle" {vle-multiseg.s}
{{readelf "-l" vle-multiseg-4.d}} "vle-multiseg-4"}
{"VLE multiple segments 5" "-T vle-multiseg-5.ld" ""
"-mregnames -mvle" {vle-multiseg.s}
{{readelf "-l" vle-multiseg-5.d}} "vle-multiseg-5"}
{"VLE relocations 1" "-T vle.ld" ""
"-mvle" {vle-reloc-1.s vle-reloc-def-1.s}
{{objdump "-Mvle -d" vle-reloc-1.d}} "vle-reloc-1"}
{"VLE relocations 2" "-T vle.ld" ""
"-mvle" {vle-reloc-2.s vle-reloc-def-2.s}
{{objdump "-Mvle -d" vle-reloc-2.d}} "vle-reloc-2"}
{"VLE relocations 3" "-T vle.ld" ""
"-mvle" {vle-reloc-3.s vle-reloc-def-3.s}
{{objdump "-Mvle -d" vle-reloc-3.d}} "vle-reloc-3"}
}
if [istarget "powerpc*le*-*-*"] then {
set options_regsub(ld) {{-melf([3264]*)ppc} {-melf\1lppc}}
for {set i 0} {$i < [llength $ppcelftests]} {incr i} {
set line [lindex $ppcelftests $i]
set ld_options [lindex $line 1]
regsub -all elf32ppc $ld_options elf32lppc ld_options
set line [lreplace $line 1 1 $ld_options]
set ppcelftests [lreplace $ppcelftests $i $i $line]
}
if [ supports_ppc64 ] then {
for {set i 0} {$i < [llength $ppc64elftests]} {incr i} {
set line [lindex $ppc64elftests $i]
set ld_options [lindex $line 1]
regsub -all elf64ppc $ld_options elf64lppc ld_options
set line [lreplace $line 1 1 $ld_options]
set ppc64elftests [lreplace $ppc64elftests $i $i $line]
}
}
}
run_ld_link_tests $ppcelftests
if [ supports_ppc64 ] then {
run_ld_link_tests $ppc64elftests
run_dump_test "relbrlt"
run_dump_test "elfv2so"
run_dump_test "elfv2exe"
run_dump_test "elfv2-2so"
run_dump_test "elfv2-2exe"
run_dump_test "ambiguousv1"
run_dump_test "ambiguousv1b"
run_dump_test "ambiguousv2"
run_dump_test "ambiguousv2b"
run_dump_test "defsym"
run_dump_test "tocvar"
run_dump_test "tocnovar"
run_dump_test "tlsld"
run_dump_test "relocsort"
run_dump_test "addpcis"
}
run_dump_test "tlsld32"
if { [istarget "powerpc*-eabi*"] } {
run_ld_link_tests $ppceabitests
}
run_dump_test "plt1"
run_dump_test "sdabase"
run_dump_test "sdabase2"
run_dump_test "attr-gnu-4-00"
run_dump_test "attr-gnu-4-01"
run_dump_test "attr-gnu-4-02"
run_dump_test "attr-gnu-4-03"
run_dump_test "attr-gnu-4-10"
run_dump_test "attr-gnu-4-11"
run_dump_test "attr-gnu-4-12"
run_dump_test "attr-gnu-4-13"
run_dump_test "attr-gnu-4-14"
run_dump_test "attr-gnu-4-20"
run_dump_test "attr-gnu-4-21"
run_dump_test "attr-gnu-4-22"
run_dump_test "attr-gnu-4-23"
run_dump_test "attr-gnu-4-24"
run_dump_test "attr-gnu-4-31"
run_dump_test "attr-gnu-4-32"
run_dump_test "attr-gnu-4-33"
run_dump_test "attr-gnu-4-34"
run_dump_test "attr-gnu-4-41"
run_dump_test "attr-gnu-8-11"
run_dump_test "attr-gnu-8-23"
run_dump_test "attr-gnu-8-31"
run_dump_test "attr-gnu-12-11"
run_dump_test "attr-gnu-12-21"
run_dump_test "vle-multiseg-6"
run_dump_test "ppc476-shared"
run_dump_test "ppc476-shared2"
|