diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-06-25 00:45:22 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-06-27 14:22:25 -0700 |
commit | 67b1d28b5214bd5dfff1817a1771d0435ff44591 (patch) | |
tree | cb5327147eee64c73deac27e43124299f4dc6df2 | |
parent | 632c5372771a6f167f3be554b2f84582169ffc07 (diff) | |
download | gdb-67b1d28b5214bd5dfff1817a1771d0435ff44591.zip gdb-67b1d28b5214bd5dfff1817a1771d0435ff44591.tar.gz gdb-67b1d28b5214bd5dfff1817a1771d0435ff44591.tar.bz2 |
Set BFD_DECOMPRESS when reading build-id debuglink
We should set BFD_DECOMPRESS to decompress sections unless dumping the
section contents when reading build-id debuglink.
PR binutils/31925
* objdump.c (open_debug_file): Set BFD_DECOMPRESS to decompress
sections unless dumping the section contents.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Add a compress option.
Run test_build_id_debuglink with none and zlib.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
-rw-r--r-- | binutils/objdump.c | 4 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index 7182abd..3242546 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -4446,6 +4446,10 @@ open_debug_file (const char * pathname) if (data == NULL) return NULL; + /* Decompress sections unless dumping the section contents. */ + if (!dump_section_contents || decompressed_dumps) + data->flags |= BFD_DECOMPRESS; + if (! bfd_check_format (data, bfd_object)) return NULL; diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 493e31b..7e29ebf 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -598,7 +598,7 @@ if { ![is_elf_format] } then { file_on_host delete $output } -proc test_build_id_debuglink {} { +proc test_build_id_debuglink {option} { global srcdir global subdir global env @@ -608,13 +608,13 @@ proc test_build_id_debuglink {} { global CFLAGS_FOR_TARGET global exe - set test "build-id-debuglink" + set test "build-id-debuglink ($option)" # Use a fixed build-id. if { [info exists CFLAGS_FOR_TARGET] } { set save_CFLAGS_FOR_TARGET $CFLAGS_FOR_TARGET } - set CFLAGS_FOR_TARGET "-g -Wl,--build-id=0x12345678abcdef01" + set CFLAGS_FOR_TARGET "-g -Wl,--build-id=0x12345678abcdef01,--compress-debug-sections=$option" if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog${exe} executable debug] != "" } { unsupported "$test (build)" @@ -676,7 +676,8 @@ proc test_build_id_debuglink {} { } if {[is_elf_format]} then { - test_build_id_debuglink + test_build_id_debuglink none + test_build_id_debuglink zlib } # Test objdump -Wk on a file containing debug links. |