Properly convert objects between different ELF classes
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / compress.exp
CommitLineData
b90efa5b 1# Copyright (C) 2010-2015 Free Software Foundation, Inc.
4a114e3e
L
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
65951855 7#
4a114e3e
L
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
65951855 12#
4a114e3e
L
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17# Test compressed .debug section.
18
dae148f3 19if { [is_remote host] || ![is_elf_format] } then {
4a114e3e
L
20 return
21}
22
e268c0a6
L
23set testfile tmpdir/dw2-1
24set compressedfile tmpdir/dw2-1-compressed
4a114e3e 25set copyfile tmpdir/dw2-copy
e268c0a6
L
26set compressedfile2 tmpdir/dw2-2-compressed
27set libfile tmpdir/libdw2
4a114e3e 28set compressedcopyfile tmpdir/dw2-copy-compressed
e268c0a6
L
29set testfile3 tmpdir/dw2-3
30set compressedfile3 tmpdir/dw2-3-compressed
4a114e3e 31
e268c0a6 32if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${testfile}.o --nocompress-debug-sections] } then {
6dbf72d7 33 unsupported "compressed debug sections"
4a114e3e
L
34 return
35}
36
e268c0a6 37if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}.o --compress-debug-sections] } then {
4a114e3e
L
38 unsupported "compressed debug sections"
39 return
40}
41
fd5136e5 42set got [remote_exec host "cmp ${testfile}.o ${compressedfile}.o"]
317974f6
L
43# Use it to set up xfail.
44set exec_output [lindex $got 1]
45if [string match "" $exec_output] then {
46 set compression_used ""
47} else {
48 set compression_used "yes"
49}
50
e268c0a6 51if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}.o --compress-debug-sections] } then {
4a114e3e
L
52 unsupported "compressed debug sections"
53 return
54}
55
e268c0a6
L
56if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o --nocompress-debug-sections] } then {
57 unsupported "compressed debug sections"
58 return
59}
60
61if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}.o --compress-debug-sections] } then {
62 unsupported "compressed debug sections"
63 return
64}
65
66remote_file host delete ${libfile}.a
67set got [binutils_run $AR "rc ${libfile}.a ${compressedfile}.o ${compressedfile2}.o ${compressedfile3}.o"]
4a114e3e
L
68if ![string match "" $got] then {
69 fail "compressed debug sections"
70 return
71}
72
73set testname "objcopy compress debug sections"
e268c0a6 74set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}.o ${copyfile}.o"]
4a114e3e
L
75if ![string match "" $got] then {
76 fail "objcopy ($testname)"
77} else {
e268c0a6
L
78 send_log "cmp ${compressedfile}.o ${copyfile}.o\n"
79 verbose "cmp ${compressedfile}.o ${copyfile}.o"
80 set src1 ${compressedfile}.o
4a114e3e
L
81 set src2 ${copyfile}.o
82 set status [remote_exec build cmp "${src1} ${src2}"]
83 set exec_output [lindex $status 1]
84 set exec_output [prune_warnings $exec_output]
85
86 if [string match "" $exec_output] then {
87 pass "objcopy ($testname)"
88 } else {
89 send_log "$exec_output\n"
90 verbose "$exec_output" 1
91 fail "objcopy ($testname)"
92 }
93}
94
95set testname "objcopy decompress compressed debug sections"
e268c0a6 96set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}.o ${copyfile}.o"]
4a114e3e
L
97if ![string match "" $got] then {
98 fail "objcopy ($testname)"
99} else {
e268c0a6
L
100 send_log "cmp ${testfile}.o ${copyfile}.o\n"
101 verbose "cmp ${testfile}.o ${copyfile}.o"
102 set src1 ${testfile}.o
4a114e3e
L
103 set src2 ${copyfile}.o
104 set status [remote_exec build cmp "${src1} ${src2}"]
105 set exec_output [lindex $status 1]
106 set exec_output [prune_warnings $exec_output]
107
108 if [string match "" $exec_output] then {
109 pass "objcopy ($testname)"
110 } else {
111 send_log "$exec_output\n"
112 verbose "$exec_output" 1
113 fail "objcopy ($testname)"
114 }
115}
116
117set testname "objcopy decompress debug sections in archive"
e268c0a6 118set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}.a ${copyfile}.a"]
4a114e3e
L
119if ![string match "" $got] then {
120 fail "objcopy ($testname)"
121} else {
122 set got [remote_exec host "$READELF -S --wide ${copyfile}.a" "" "/dev/null" "tmpdir/libdw2.out"]
123
124 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
125 fail "$testname (reason: unexpected output)"
126 send_log $got
127 send_log "\n"
128 }
129
130 if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
131 fail "$testname"
132 } else {
133 pass "$testname"
134 }
135}
136
317974f6
L
137# Xfail this test if there are no compressed sections.
138setup_xfail "$compression_used$target_triplet"
4a114e3e
L
139set testname "objcopy compress debug sections in archive"
140set got [binutils_run $OBJCOPY "--compress-debug-sections ${copyfile}.a ${compressedcopyfile}.a"]
141if ![string match "" $got] then {
142 fail "objcopy ($testname)"
143} else {
144 set got [remote_exec host "$OBJDUMP -s -j .zdebug_line ${compressedcopyfile}.a" "" "/dev/null" "tmpdir/libdw2-compressed.out"]
145
146 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
147 fail "$testname (reason: unexpected output)"
148 send_log $got
149 send_log "\n"
150 }
151
317974f6 152 setup_xfail "$compression_used$target_triplet"
4a114e3e
L
153 if { [regexp_diff tmpdir/libdw2-compressed.out $srcdir/$subdir/libdw2-compressed.out] } then {
154 fail "$testname"
155 } else {
156 pass "$testname"
157 }
158}
5a5ed5b0 159
a9481b58 160set testname "objdump compress debug sections"
e268c0a6 161set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"]
a9481b58
L
162if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
163 fail "$testname"
164 send_log "$got\n"
165}
166if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
167 fail "$testname"
168} else {
169 pass "$testname"
170}
171
e268c0a6
L
172set testname "objdump compress debug sections 3"
173set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"]
174if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
175 fail "$testname"
176 send_log "$got\n"
177}
178if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
179 fail "$testname"
180} else {
181 pass "$testname"
182}
5a5ed5b0 183
e268c0a6 184if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S ${testfile}empty.o --nocompress-debug-sections] } then {
5a5ed5b0
L
185 unsupported "compressed debug sections"
186 return
187}
188
189set testname "objcopy compress empty debug sections"
e268c0a6 190set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}empty.o ${copyfile}empty.o"]
5a5ed5b0
L
191if ![string match "" $got] then {
192 fail "objcopy ($testname)"
193} else {
e268c0a6
L
194 send_log "cmp ${testfile}empty.o ${copyfile}empty.o\n"
195 verbose "cmp ${testfile}empty.o ${copyfile}empty.o"
196 set src1 ${testfile}empty.o
197 set src2 ${copyfile}empty.o
5a5ed5b0
L
198 set status [remote_exec build cmp "${src1} ${src2}"]
199 set exec_output [lindex $status 1]
200 set exec_output [prune_warnings $exec_output]
201
202 if [string match "" $exec_output] then {
203 pass "objcopy ($testname)"
204 } else {
205 send_log "$exec_output\n"
206 verbose "$exec_output" 1
207 fail "objcopy ($testname)"
208 }
209}
a953eec9
NC
210
211if ![is_remote host] {
212 set tempfile tmpdir/debug_str.o
213 set copyfile tmpdir/debug_str.copy
214} else {
215 set tempfile [remote_download host tmpdir/debug_str.o]
216 set copyfile debug_str.copy
217}
218
219run_dump_test "debug_str"
151411f8
L
220
221if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gabi.o --compress-debug-sections=zlib-gabi] } then {
222 fail "compressed debug sections with zlib-gabi"
223 return
224}
225
226if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then {
227 fail "compressed debug sections with zlib-gnu"
228 return
229}
230
231set src1 ${compressedfile}gnu.o
232set src2 ${compressedfile}.o
233set status [remote_exec build cmp "${src1} ${src2}"]
234set exec_output [lindex $status 1]
235set exec_output [prune_warnings $exec_output]
236if ![string match "" $exec_output] then {
237 fail "compressed debug sections with zlib-gnu"
238 return
239}
240
241if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gabi.o --compress-debug-sections=zlib-gabi] } then {
242 fail "compressed debug sections with zlib-gabi"
243 return
244}
245
246if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gnu.o --compress-debug-sections=zlib-gnu] } then {
247 fail "compressed debug sections with zlib-gnu"
248 return
249}
250
251set src1 ${compressedfile2}gnu.o
252set src2 ${compressedfile2}.o
253set status [remote_exec build cmp "${src1} ${src2}"]
254set exec_output [lindex $status 1]
255set exec_output [prune_warnings $exec_output]
256if ![string match "" $exec_output] then {
257 fail "compressed debug sections with zlib-gnu"
258 return
259}
260
261if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gabi.o --compress-debug-sections=zlib-gabi] } then {
262 fail "compressed debug sections with zlib-gabi"
263 return
264}
265
266set testname "readelf -t zlib-gabi compress debug sections"
267set got [remote_exec host "$READELF -t --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rt"]
268if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
269 fail "$testname (reason: unexpected output)"
270 send_log "$got\n"
271}
272if { [regexp_diff tmpdir/dw2-3.rt $srcdir/$subdir/dw2-3.rt] } then {
273 fail "$testname"
274} else {
275 pass "$testname"
276}
277
278set testname "readelf -S zlib-gabi compress debug sections"
279set got [remote_exec host "$READELF -S --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rS"]
280if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
281 fail "$testname (reason: unexpected output)"
282 send_log "$got\n"
283}
284if { [regexp_diff tmpdir/dw2-3.rS $srcdir/$subdir/dw2-3.rS] } then {
285 fail "$testname"
286} else {
287 pass "$testname"
288}
289
290if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gnu.o --compress-debug-sections=zlib-gnu] } then {
291 fail "compressed debug sections with zlib-gnu"
292 return
293}
294
295set src1 ${compressedfile3}gnu.o
296set src2 ${compressedfile3}.o
297set status [remote_exec build cmp "${src1} ${src2}"]
298set exec_output [lindex $status 1]
299set exec_output [prune_warnings $exec_output]
300if ![string match "" $exec_output] then {
301 fail "compressed debug sections with zlib-gnu"
302 return
303}
304
305remote_file host delete ${libfile}gabi.a
306set got [binutils_run $AR "rc ${libfile}gabi.a ${compressedfile}gabi.o ${compressedfile2}gabi.o ${compressedfile3}gabi.o"]
307if ![string match "" $got] then {
308 fail "compressed debug sections"
309 return
310}
311
312set testname "objcopy compress debug sections with zlib-gabi"
313set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile}.o ${copyfile}gabi.o"]
314if ![string match "" $got] then {
315 fail "objcopy ($testname)"
316 return
317}
318send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
319verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
320set src1 ${compressedfile}gabi.o
321set src2 ${copyfile}gabi.o
322set status [remote_exec build cmp "${src1} ${src2}"]
323set exec_output [lindex $status 1]
324set exec_output [prune_warnings $exec_output]
325if ![string match "" $exec_output] then {
326 send_log "$exec_output\n"
327 verbose "$exec_output" 1
328 fail "objcopy ($testname)"
329} else {
330 pass "objcopy ($testname)"
331}
332
333set testname "objcopy decompress compressed debug sections with zlib-gabi"
334set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}gabi.o ${copyfile}gabi.o"]
335if ![string match "" $got] then {
336 fail "objcopy ($testname)"
337 return
338}
339send_log "cmp ${testfile}.o ${copyfile}gabi.o\n"
340verbose "cmp ${testfile}.o ${copyfile}gabi.o"
341set src1 ${testfile}.o
342set src2 ${copyfile}gabi.o
343set status [remote_exec build cmp "${src1} ${src2}"]
344set exec_output [lindex $status 1]
345set exec_output [prune_warnings $exec_output]
346if ![string match "" $exec_output] then {
347 send_log "$exec_output\n"
348 verbose "$exec_output" 1
349 fail "objcopy ($testname)"
350} else {
351 pass "objcopy ($testname)"
352}
353
354set testname "objcopy zlib-gnu compress debug sections with zlib-gabi"
355set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile}.o ${copyfile}gabi.o"]
356if ![string match "" $got] then {
357 fail "objcopy ($testname)"
358 return
359}
360send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
361verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
362set src1 ${compressedfile}gabi.o
363set src2 ${copyfile}gabi.o
364set status [remote_exec build cmp "${src1} ${src2}"]
365set exec_output [lindex $status 1]
366set exec_output [prune_warnings $exec_output]
367if ![string match "" $exec_output] then {
368 send_log "$exec_output\n"
369 verbose "$exec_output" 1
370 fail "objcopy ($testname)"
371} else {
372 pass "objcopy ($testname)"
373}
374
375set testname "objcopy zlib-gabi compress debug sections with zlib-gnu"
376set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile}gabi.o ${copyfile}gnu.o"]
377if ![string match "" $got] then {
378 fail "objcopy ($testname)"
379 return
380}
381send_log "cmp ${compressedfile}gnu.o ${copyfile}gnu.o\n"
382verbose "cmp ${compressedfile}gnu.o ${copyfile}gnu.o"
383set src1 ${compressedfile}gnu.o
384set src2 ${copyfile}gnu.o
385set status [remote_exec build cmp "${src1} ${src2}"]
386set exec_output [lindex $status 1]
387set exec_output [prune_warnings $exec_output]
388if ![string match "" $exec_output] then {
389 send_log "$exec_output\n"
390 verbose "$exec_output" 1
391 fail "objcopy ($testname)"
392} else {
393 pass "objcopy ($testname)"
394}
395
396set testname "objcopy compress debug sections 3 with zlib-gabi"
397set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile3}.o ${copyfile}gabi.o"]
398if ![string match "" $got] then {
399 fail "objcopy ($testname)"
400 return
401}
402send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
403verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
404set src1 ${compressedfile3}gabi.o
405set src2 ${copyfile}gabi.o
406set status [remote_exec build cmp "${src1} ${src2}"]
407set exec_output [lindex $status 1]
408set exec_output [prune_warnings $exec_output]
409if ![string match "" $exec_output] then {
410 send_log "$exec_output\n"
411 verbose "$exec_output" 1
412 fail "objcopy ($testname)"
413} else {
414 pass "objcopy ($testname)"
415}
416
417set testname "objcopy decompress compressed debug sections 3 with zlib-gabi"
418set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile3}gabi.o ${copyfile}gabi.o"]
419if ![string match "" $got] then {
420 fail "objcopy ($testname)"
421 return
422}
423send_log "cmp ${testfile3}.o ${copyfile}gabi.o\n"
424verbose "cmp ${testfile3}.o ${copyfile}gabi.o"
425set src1 ${testfile3}.o
426set src2 ${copyfile}gabi.o
427set status [remote_exec build cmp "${src1} ${src2}"]
428set exec_output [lindex $status 1]
429set exec_output [prune_warnings $exec_output]
430if ![string match "" $exec_output] then {
431 send_log "$exec_output\n"
432 verbose "$exec_output" 1
433 fail "objcopy ($testname)"
434} else {
435 pass "objcopy ($testname)"
436}
437
438set testname "objcopy zlib-gnu compress debug sections 3 with zlib-gabi"
439set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile3}.o ${copyfile}gabi.o"]
440if ![string match "" $got] then {
441 fail "objcopy ($testname)"
442 return
443}
444send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
445verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
446set src1 ${compressedfile3}gabi.o
447set src2 ${copyfile}gabi.o
448set status [remote_exec build cmp "${src1} ${src2}"]
449set exec_output [lindex $status 1]
450set exec_output [prune_warnings $exec_output]
451if ![string match "" $exec_output] then {
452 send_log "$exec_output\n"
453 verbose "$exec_output" 1
454 fail "objcopy ($testname)"
455} else {
456 pass "objcopy ($testname)"
457}
458
459set testname "objcopy zlib-gabi compress debug sections 3 with zlib-gnu"
460set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile3}gabi.o ${copyfile}gnu.o"]
461if ![string match "" $got] then {
462 fail "objcopy ($testname)"
463 return
464}
465send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
466verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
467set src1 ${compressedfile3}gnu.o
468set src2 ${copyfile}gnu.o
469set status [remote_exec build cmp "${src1} ${src2}"]
470set exec_output [lindex $status 1]
471set exec_output [prune_warnings $exec_output]
472if ![string match "" $exec_output] then {
473 send_log "$exec_output\n"
474 verbose "$exec_output" 1
475 fail "objcopy ($testname)"
476} else {
477 pass "objcopy ($testname)"
478}
479
480set testname "objcopy zlib-gnu compress debug sections 3"
481set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
482if ![string match "" $got] then {
483 fail "objcopy ($testname)"
484 return
485}
486send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
487verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
488set src1 ${compressedfile3}gnu.o
489set src2 ${copyfile}gnu.o
490set status [remote_exec build cmp "${src1} ${src2}"]
491set exec_output [lindex $status 1]
492set exec_output [prune_warnings $exec_output]
493if ![string match "" $exec_output] then {
494 send_log "$exec_output\n"
495 verbose "$exec_output" 1
496 fail "objcopy ($testname)"
497} else {
498 pass "objcopy ($testname)"
499}
500
501set testname "objcopy zlib-gnu compress debug sections 3"
502set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
503if ![string match "" $got] then {
504 fail "objcopy ($testname)"
505 return
506}
507send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
508verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
509set src1 ${compressedfile3}gnu.o
510set src2 ${copyfile}gnu.o
511set status [remote_exec build cmp "${src1} ${src2}"]
512set exec_output [lindex $status 1]
513set exec_output [prune_warnings $exec_output]
514if ![string match "" $exec_output] then {
515 send_log "$exec_output\n"
516 verbose "$exec_output" 1
517 fail "objcopy ($testname)"
518} else {
519 pass "objcopy ($testname)"
520}
521
522set testname "objcopy decompress debug sections in archive with zlib-gabi"
523set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}gabi.a ${copyfile}gabi.a"]
524if ![string match "" $got] then {
525 fail "objcopy ($testname)"
526} else {
527 set got [remote_exec host "$READELF -S --wide ${copyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2.out"]
528
529 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
530 fail "$testname (reason: unexpected output)"
531 send_log $got
532 send_log "\n"
533 }
534
535 if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
536 fail "$testname"
537 } else {
538 pass "$testname"
539 }
540}
541
542set testname "objcopy compress debug sections in archive with zlib-gabi"
543set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"]
544if ![string match "" $got] then {
545 fail "objcopy ($testname)"
546} else {
dab394de 547 set got [remote_exec host "$OBJDUMP -W ${compressedcopyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2-compressedgabi.out"]
151411f8
L
548
549 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
550 fail "$testname (reason: unexpected output)"
551 send_log $got
552 send_log "\n"
553 }
554
555 if { [regexp_diff tmpdir/libdw2-compressedgabi.out $srcdir/$subdir/libdw2-compressedgabi.out] } then {
556 fail "$testname"
557 } else {
558 pass "$testname"
559 }
560}
561
562set testname "objdump compress debug sections 3 with zlib-gabi"
563set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"]
564if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
565 fail "$testname"
566 send_log "$got\n"
567}
f6fe1ccd 568if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
151411f8
L
569 fail "$testname"
570} else {
571 pass "$testname"
572}
88988473
L
573
574proc convert_test { testname as_flags objcop_flags } {
575 global srcdir
576 global subdir
577 global testfile3
578 global copyfile
579 global OBJCOPY
580 global OBJDUMP
581
582 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o "$as_flags"] } then {
583 unresolved "$testname"
584 return
585 }
586
587 set got [binutils_run $OBJCOPY "$objcop_flags ${testfile3}.o ${copyfile}.o"]
588 if ![string match "" $got] then {
589 fail "objcopy ($testname)"
590 return
591 }
592
593 set got [remote_exec host "$OBJDUMP -W ${copyfile}.o" "" "/dev/null" "objdump.out"]
594
595 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
596 fail "$testname (reason: unexpected output)"
597 send_log $got
598 send_log "\n"
599 return
600 }
601
602 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
603 fail "$testname"
604 } else {
605 pass "$testname"
606 }
607}
608
609if { ([istarget "x86_64-*-elf*"]
610 || [istarget "x86_64-*-linux*"]) } {
611 set testname "Convert x86-64 object with zlib-gabi to x32 (1)"
612 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64"
613
614 set testname "Convert x86-64 object with zlib-gabi to x32 (2)"
615 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
616
617 set testname "Convert x86-64 object with zlib-gabi to x32 (3)"
618 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --decompress-debug-sections"
619
620 set testname "Convert x86-64 object with zlib-gnu to x32 (1)"
621 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64"
622
623 set testname "Convert x86-64 object with zlib-gnu to x32 (2)"
624 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
625
626 set testname "Convert x86-64 object with zlib-gnu to x32 (3)"
627 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --decompress-debug-sections"
628
629 set testname "Convert x86-64 object to x32 (1)"
630 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64"
631
632 set testname "Convert x86-64 object to x32 (2)"
633 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
634
635 set testname "Convert x86-64 object to x32 (3)"
636 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
637
638
639 set testname "Convert x32 object with zlib-gabi to x86-64 (1)"
640 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64"
641
642 set testname "Convert x32 object with zlib-gabi to x86-64 (2)"
643 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
644
645 set testname "Convert x32 object with zlib-gabi to x86-64 (3)"
646 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --decompress-debug-sections"
647
648 set testname "Convert x32 object with zlib-gnu to x86-64 (1)"
649 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64"
650
651 set testname "Convert x32 object with zlib-gnu to x86-64 (2)"
652 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
653
654 set testname "Convert x32 object with zlib-gnu to x86-64 (3)"
655 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --decompress-debug-sections"
656
657 set testname "Convert x32 object to x86-64 (1)"
658 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64"
659
660 set testname "Convert x32 object to x86-64 (2)"
661 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
662
663 set testname "Convert x32 object to x86-64 (3)"
664 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
665 }
This page took 0.237771 seconds and 4 git commands to generate.