blob: d7c5e0a320166380f20145ef32464035063b0bea (
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
|
# Copyright (C) 2010-2016 Free Software Foundation, Inc.
# 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.
# Test compressed .debug section.
if { [is_remote host] || ![is_elf_format] } then {
return
}
set testfile tmpdir/dw2-1
set compressedfile tmpdir/dw2-1-compressed
set copyfile tmpdir/dw2-copy
set compressedfile2 tmpdir/dw2-2-compressed
set libfile tmpdir/libdw2
set compressedcopyfile tmpdir/dw2-copy-compressed
set testfile3 tmpdir/dw2-3
set compressedfile3 tmpdir/dw2-3-compressed
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${testfile}.o --nocompress-debug-sections] } then {
unsupported "compressed debug sections"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}.o --compress-debug-sections] } then {
unsupported "compressed debug sections"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then {
unsupported "compressed debug sections with zlib-gnu"
return
}
set got [remote_exec host "cmp ${testfile}.o ${compressedfile}gnu.o"]
# Use it to set up xfail.
set exec_output [lindex $got 1]
if [string match "" $exec_output] then {
set compression_used ""
} else {
set compression_used "yes"
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}.o --compress-debug-sections] } then {
unsupported "compressed debug sections"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o --nocompress-debug-sections] } then {
unsupported "compressed debug sections"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}.o --compress-debug-sections] } then {
unsupported "compressed debug sections"
return
}
remote_file host delete ${libfile}.a
set got [binutils_run $AR "rc ${libfile}.a ${compressedfile}.o ${compressedfile2}.o ${compressedfile3}.o"]
if ![string match "" $got] then {
fail "compressed debug sections"
return
}
set testname "objcopy compress debug sections"
set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}.o ${copyfile}.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
send_log "cmp ${compressedfile}.o ${copyfile}.o\n"
verbose "cmp ${compressedfile}.o ${copyfile}.o"
set src1 ${compressedfile}.o
set src2 ${copyfile}.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
pass "objcopy ($testname)"
} else {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
}
}
set testname "objcopy decompress compressed debug sections"
set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}.o ${copyfile}.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
send_log "cmp ${testfile}.o ${copyfile}.o\n"
verbose "cmp ${testfile}.o ${copyfile}.o"
set src1 ${testfile}.o
set src2 ${copyfile}.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
pass "objcopy ($testname)"
} else {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
}
}
set testname "objcopy decompress debug sections in archive"
set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}.a ${copyfile}.a"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
set got [remote_exec host "$READELF -S --wide ${copyfile}.a" "" "/dev/null" "tmpdir/libdw2.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log $got
send_log "\n"
}
if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
fail "$testname"
} else {
pass "$testname"
}
}
# Xfail this test if there are no compressed sections.
setup_xfail "$compression_used$target_triplet"
set testname "objcopy compress debug sections in archive with zlib-gnu"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${copyfile}.a ${compressedcopyfile}.a"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
set got [remote_exec host "$OBJDUMP -s -j .zdebug_line ${compressedcopyfile}.a" "" "/dev/null" "tmpdir/libdw2-compressed.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log $got
send_log "\n"
}
setup_xfail "$compression_used$target_triplet"
if { [regexp_diff tmpdir/libdw2-compressed.out $srcdir/$subdir/libdw2-compressed.out] } then {
fail "$testname"
} else {
pass "$testname"
}
}
set testname "objdump compress debug sections"
set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname"
send_log "$got\n"
}
if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
fail "$testname"
} else {
pass "$testname"
}
set testname "objdump compress debug sections 3"
set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname"
send_log "$got\n"
}
if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
fail "$testname"
} else {
pass "$testname"
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S ${testfile}empty.o --nocompress-debug-sections] } then {
unsupported "compressed debug sections"
return
}
set testname "objcopy compress empty debug sections"
set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}empty.o ${copyfile}empty.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
send_log "cmp ${testfile}empty.o ${copyfile}empty.o\n"
verbose "cmp ${testfile}empty.o ${copyfile}empty.o"
set src1 ${testfile}empty.o
set src2 ${copyfile}empty.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
pass "objcopy ($testname)"
} else {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
}
}
if ![is_remote host] {
set tempfile tmpdir/debug_str.o
set copyfile tmpdir/debug_str.copy
} else {
set tempfile [remote_download host tmpdir/debug_str.o]
set copyfile debug_str.copy
}
run_dump_test "debug_str"
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gabi.o --compress-debug-sections=zlib-gabi] } then {
fail "compressed debug sections with zlib-gabi"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then {
fail "compressed debug sections with zlib-gnu"
return
}
set src1 ${compressedfile}gabi.o
set src2 ${compressedfile}.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
fail "compressed debug sections with zlib-gabi"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gabi.o --compress-debug-sections=zlib-gabi] } then {
fail "compressed debug sections with zlib-gabi"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gnu.o --compress-debug-sections=zlib-gnu] } then {
fail "compressed debug sections with zlib-gnu"
return
}
set src1 ${compressedfile2}gabi.o
set src2 ${compressedfile2}.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
fail "compressed debug sections with zlib-gabi"
return
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gabi.o --compress-debug-sections=zlib-gabi] } then {
fail "compressed debug sections with zlib-gabi"
return
}
set testname "readelf -t zlib-gabi compress debug sections"
set got [remote_exec host "$READELF -t --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rt"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log "$got\n"
}
if { [regexp_diff tmpdir/dw2-3.rt $srcdir/$subdir/dw2-3.rt] } then {
fail "$testname"
} else {
pass "$testname"
}
set testname "readelf -S zlib-gabi compress debug sections"
set got [remote_exec host "$READELF -S --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rS"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log "$got\n"
}
if { [regexp_diff tmpdir/dw2-3.rS $srcdir/$subdir/dw2-3.rS] } then {
fail "$testname"
} else {
pass "$testname"
}
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gnu.o --compress-debug-sections=zlib-gnu] } then {
fail "compressed debug sections with zlib-gnu"
return
}
set src1 ${compressedfile3}gabi.o
set src2 ${compressedfile3}.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
fail "compressed debug sections with zlib-gabi"
return
}
remote_file host delete ${libfile}gabi.a
set got [binutils_run $AR "rc ${libfile}gabi.a ${compressedfile}gabi.o ${compressedfile2}gabi.o ${compressedfile3}gabi.o"]
if ![string match "" $got] then {
fail "compressed debug sections"
return
}
set testname "objcopy compress debug sections with zlib-gabi"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile}.o ${copyfile}gabi.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
set src1 ${compressedfile}gabi.o
set src2 ${copyfile}gabi.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy decompress compressed debug sections with zlib-gabi"
set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}gabi.o ${copyfile}gabi.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${testfile}.o ${copyfile}gabi.o\n"
verbose "cmp ${testfile}.o ${copyfile}gabi.o"
set src1 ${testfile}.o
set src2 ${copyfile}gabi.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy zlib-gnu compress debug sections with zlib-gabi"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile}.o ${copyfile}gabi.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
set src1 ${compressedfile}gabi.o
set src2 ${copyfile}gabi.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy zlib-gabi compress debug sections with zlib-gnu"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile}gabi.o ${copyfile}gnu.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile}gnu.o ${copyfile}gnu.o\n"
verbose "cmp ${compressedfile}gnu.o ${copyfile}gnu.o"
set src1 ${compressedfile}gnu.o
set src2 ${copyfile}gnu.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy compress debug sections 3 with zlib-gabi"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile3}.o ${copyfile}gabi.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
set src1 ${compressedfile3}gabi.o
set src2 ${copyfile}gabi.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy decompress compressed debug sections 3 with zlib-gabi"
set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile3}gabi.o ${copyfile}gabi.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${testfile3}.o ${copyfile}gabi.o\n"
verbose "cmp ${testfile3}.o ${copyfile}gabi.o"
set src1 ${testfile3}.o
set src2 ${copyfile}gabi.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy zlib-gnu compress debug sections 3 with zlib-gabi"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile3}.o ${copyfile}gabi.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
set src1 ${compressedfile3}gabi.o
set src2 ${copyfile}gabi.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy zlib-gabi compress debug sections 3 with zlib-gnu"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile3}gabi.o ${copyfile}gnu.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
set src1 ${compressedfile3}gnu.o
set src2 ${copyfile}gnu.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy zlib-gnu compress debug sections 3"
set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
set src1 ${compressedfile3}gnu.o
set src2 ${copyfile}gnu.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy zlib-gnu compress debug sections 3"
set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
set src1 ${compressedfile3}gnu.o
set src2 ${copyfile}gnu.o
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
} else {
pass "objcopy ($testname)"
}
set testname "objcopy decompress debug sections in archive with zlib-gabi"
set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}gabi.a ${copyfile}gabi.a"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
set got [remote_exec host "$READELF -S --wide ${copyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log $got
send_log "\n"
}
if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
fail "$testname"
} else {
pass "$testname"
}
}
set testname "objcopy compress debug sections in archive with zlib-gabi"
set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
} else {
set got [remote_exec host "$OBJDUMP -W ${compressedcopyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2-compressedgabi.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log $got
send_log "\n"
}
if { [regexp_diff tmpdir/libdw2-compressedgabi.out $srcdir/$subdir/libdw2-compressedgabi.out] } then {
fail "$testname"
} else {
pass "$testname"
}
}
set testname "objdump compress debug sections 3 with zlib-gabi"
set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname"
send_log "$got\n"
}
if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
fail "$testname"
} else {
pass "$testname"
}
proc convert_test { testname as_flags objcop_flags } {
global srcdir
global subdir
global testfile3
global copyfile
global OBJCOPY
global OBJDUMP
if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o "$as_flags"] } then {
unresolved "$testname"
return
}
set got [binutils_run $OBJCOPY "$objcop_flags ${testfile3}.o ${copyfile}.o"]
if ![string match "" $got] then {
fail "objcopy ($testname)"
return
}
set got [remote_exec host "$OBJDUMP -W ${copyfile}.o" "" "/dev/null" "objdump.out"]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname (reason: unexpected output)"
send_log $got
send_log "\n"
return
}
if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
fail "$testname"
} else {
pass "$testname"
}
}
if { ([istarget "x86_64-*-elf*"]
|| [istarget "x86_64-*-linux*"]) } {
set testname "Convert x86-64 object with zlib-gabi to x32 (1)"
convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64"
set testname "Convert x86-64 object with zlib-gabi to x32 (2)"
convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
set testname "Convert x86-64 object with zlib-gabi to x32 (3)"
convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --decompress-debug-sections"
set testname "Convert x86-64 object with zlib-gnu to x32 (1)"
convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64"
set testname "Convert x86-64 object with zlib-gnu to x32 (2)"
convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
set testname "Convert x86-64 object with zlib-gnu to x32 (3)"
convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --decompress-debug-sections"
set testname "Convert x86-64 object to x32 (1)"
convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64"
set testname "Convert x86-64 object to x32 (2)"
convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
set testname "Convert x86-64 object to x32 (3)"
convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
set testname "Convert x32 object with zlib-gabi to x86-64 (1)"
convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64"
set testname "Convert x32 object with zlib-gabi to x86-64 (2)"
convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
set testname "Convert x32 object with zlib-gabi to x86-64 (3)"
convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --decompress-debug-sections"
set testname "Convert x32 object with zlib-gnu to x86-64 (1)"
convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64"
set testname "Convert x32 object with zlib-gnu to x86-64 (2)"
convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
set testname "Convert x32 object with zlib-gnu to x86-64 (3)"
convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --decompress-debug-sections"
set testname "Convert x32 object to x86-64 (1)"
convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64"
set testname "Convert x32 object to x86-64 (2)"
convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
set testname "Convert x32 object to x86-64 (3)"
convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
}
|