Re: [PATCH v3] binutils, gdb: support zstd compressed debug sections

Fangrui Song via Gdb-patches
2022-09-27T18:53:45Z

On Tue, Sep 27, 2022 at 11:08 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> Fangrui Song via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> > PR29397 PR29563: The new configure option --with-zstd defaults to auto.
> > If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support zstd
> > compressed debug sections for most tools.
>
> > * bfd: for addr2line, objdump --dwarf, gdb, etc
> > * gas: support --compress-debug-sections=zstd
> > * ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd
> > * objcopy: support ELFCOMPRESS_ZSTD input for
> > --decompress-debug-sections and --compress-debug-sections=zstd
> > * gdb: support ELFCOMPRESS_ZSTD input. The bfd change references zstd
> > symbols, so gdb has to link against -lzstd in this patch.
>
> This also needs some change to the sims.
> I see failures like this with git master:
>
> make[4]: Entering directory '/home/tromey/gdb/build/sim/bpf'
> CCLD run
> ../../bfd/libbfd.a(compress.o):compress.c:function decompress_contents: error: undefined reference to 'ZSTD_decompress'
> ../../bfd/libbfd.a(compress.o):compress.c:function decompress_contents: error: undefined reference to 'ZSTD_isError'
> (unknown):176: error: undefined reference to 'ZSTD_compress'
> (unknown):179: error: undefined reference to 'ZSTD_isError'
> collect2: error: ld returned 1 exit status
>
> You'll see them all if you do a build with all sims enabled.
>
> thanks,
> Tom

Thanks for the report and Tom's IRC chat with me about the
`../../configure --enable-targets --enable-sim; make all-gdb` build.
Tom confirmed that the latest commit `sim: Link ZSTD_LIBS` has fixed
the problem.