forked from Imagelibrary/binutils-gdb
In a SHF_COMPRESSED compressed section, the raw compressed data should begin immediately after the compression header. This patch removes the extra zlib header from the SHF_COMPRESSED section. bfd/ * bfd.c (bfd_update_compression_header): Also write the zlib header if the SHF_COMPRESSED bit cleared.. (bfd_check_compression_header): Return the uncompressed size. * compress.c (decompress_contents): Don't skip the zlib header. (bfd_compress_section_contents): Properly handle ELFCOMPRESS_ZLIB, which doesn't have the zlib header. (bfd_init_section_decompress_status): Likewise. (bfd_get_full_section_contents): Updated. (bfd_is_section_compressed): Likewise. (bfd_is_section_compressed_with_header): Return the uncompressed size. * elf.c (_bfd_elf_make_section_from_shdr): Updated. * bfd-in2.h: Regenerated. binutils/ * readelf.c (uncompress_section_contents): Add a parameter for uncompressed size. Don't check the zlib header. (load_specific_debug_section): Updated. binutils/testsuite/ * binutils-all/compress.exp: Replace "$OBJDUMP -s -j .debug_info" with "$OBJDUMP -W". * binutils-all/libdw2-compressedgabi.out: Updated. gas/ 2015-05-14 H.J. Lu <hongjiu.lu@intel.com> * write.c (compress_debug): Don't write the zlib header, which is handled by bfd_update_compression_header.
573 lines
19 KiB
Plaintext
573 lines
19 KiB
Plaintext
# Copyright (C) 2010-2015 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
|
|
}
|
|
|
|
set got [remote_exec host "cmp ${testfile}.o ${compressedfile}.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"
|
|
set got [binutils_run $OBJCOPY "--compress-debug-sections ${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}gnu.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-gnu"
|
|
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}gnu.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-gnu"
|
|
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}gnu.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-gnu"
|
|
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"
|
|
}
|