2 # Free Software Foundation
, Inc.
4 # This
program is free software
; you can redistribute it and
/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation
; either version
3 of the License
, or
7 #
(at your option
) any later version.
9 # This
program is distributed in the hope that it will be useful
,
10 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License
for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this
program; if not
, write to the Free Software
16 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
, MA
02110-1301, USA.
18 # Test compressed .debug section.
20 if { [is_remote host
] ||
![is_elf_format
] } then {
24 set testfile tmpdir
/dw2
-1.o
25 set compressedfile tmpdir
/dw2
-1-compressed.o
26 set copyfile tmpdir
/dw2
-copy
27 set compressedfile2 tmpdir
/dw2
-2-compressed.o
28 set libfile tmpdir
/libdw2.a
29 set compressedcopyfile tmpdir
/dw2
-copy
-compressed
31 if { ![binutils_assemble_flags $srcdir
/$subdir
/dw2
-1.S $testfile
--nocompress
-debug
-sections
] } then {
32 unsupported
"compressed debug sections"
36 if { ![binutils_assemble_flags $srcdir
/$subdir
/dw2
-1.S $compressedfile
--compress
-debug
-sections
] } then {
37 unsupported
"compressed debug sections"
41 if { ![binutils_assemble_flags $srcdir
/$subdir
/dw2
-2.S $compressedfile2
--compress
-debug
-sections
] } then {
42 unsupported
"compressed debug sections"
46 remote_file host
delete $libfile
47 set got
[binutils_run $AR
"rc $libfile $compressedfile $compressedfile2"]
48 if ![string match
"" $got] then {
49 fail
"compressed debug sections"
53 set testname
"objcopy compress debug sections"
54 set got
[binutils_run $OBJCOPY
"--compress-debug-sections $testfile ${copyfile}.o"]
55 if ![string match
"" $got] then {
56 fail
"objcopy ($testname)"
58 send_log
"cmp $compressedfile ${copyfile}.o\n"
59 verbose
"cmp $compressedfile ${copyfile}.o"
60 set src1 $
{compressedfile
}
61 set src2 $
{copyfile
}.o
62 set status [remote_exec build cmp
"${src1} ${src2}"]
63 set exec_output
[lindex $
status 1]
64 set exec_output
[prune_warnings $exec_output
]
66 if [string match
"" $exec_output] then {
67 pass
"objcopy ($testname)"
69 send_log
"$exec_output\n"
70 verbose
"$exec_output" 1
71 fail
"objcopy ($testname)"
75 set testname
"objcopy decompress compressed debug sections"
76 set got
[binutils_run $OBJCOPY
"--decompress-debug-sections $compressedfile ${copyfile}.o"]
77 if ![string match
"" $got] then {
78 fail
"objcopy ($testname)"
80 send_log
"cmp $testfile ${copyfile}.o\n"
81 verbose
"cmp $testfile ${copyfile}.o"
83 set src2 $
{copyfile
}.o
84 set status [remote_exec build cmp
"${src1} ${src2}"]
85 set exec_output
[lindex $
status 1]
86 set exec_output
[prune_warnings $exec_output
]
88 if [string match
"" $exec_output] then {
89 pass
"objcopy ($testname)"
91 send_log
"$exec_output\n"
92 verbose
"$exec_output" 1
93 fail
"objcopy ($testname)"
97 set testname
"objcopy decompress debug sections in archive"
98 set got
[binutils_run $OBJCOPY
"--decompress-debug-sections $libfile ${copyfile}.a"]
99 if ![string match
"" $got] then {
100 fail
"objcopy ($testname)"
102 set got
[remote_exec host
"$READELF -S --wide ${copyfile}.a" "" "/dev/null" "tmpdir/libdw2.out"]
104 if { [lindex $got
0] != 0 ||
![string match
"" [lindex $got 1]] } then {
105 fail
"$testname (reason: unexpected output)"
110 if { [regexp_diff tmpdir
/libdw2.out $srcdir
/$subdir
/libdw2.out
] } then {
117 set testname
"objcopy compress debug sections in archive"
118 set got
[binutils_run $OBJCOPY
"--compress-debug-sections ${copyfile}.a ${compressedcopyfile}.a"]
119 if ![string match
"" $got] then {
120 fail
"objcopy ($testname)"
122 set got
[remote_exec host
"$OBJDUMP -s -j .zdebug_line ${compressedcopyfile}.a" "" "/dev/null" "tmpdir/libdw2-compressed.out"]
124 if { [lindex $got
0] != 0 ||
![string match
"" [lindex $got 1]] } then {
125 fail
"$testname (reason: unexpected output)"
130 if { [regexp_diff tmpdir
/libdw2
-compressed.out $srcdir
/$subdir
/libdw2
-compressed.out
] } then {