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

Fangrui Song maskray@google.com
Tue Sep 20 05:40:50 GMT 2022


On 2022-09-19, Simon Marchi wrote:
>Hi,
>
>Running `autoreconf -vf` in the various subdirectories, I get some
>diffs.  Can you run that command in the directories you touch?

Thanks for the help on the build system:)
I did not know autoreconf -vf.

Now I have such a script to help me regenerate autoconf/automake files.

for i in ld bfd gas gdb binutils; do
   (cd ~/Dev/binutils-gdb/$i; PATH=~/projects/automake-1.15.1/bin:$PATH
   ~/projects/autoconf-2.69/bin/autoreconf -vf)
done

https://gitlab.com/MaskRay/binutils-gdb/-/commits/zstd
contains the updated patch.

(For folks who don't mind github, it's also on
https://github.com/MaskRay/binutils-gdb/tree/zstd)

>> diff --git a/config/zstd.m4 b/config/zstd.m4
>> new file mode 100644
>> index 00000000000..6495a039f2c
>> --- /dev/null
>> +++ b/config/zstd.m4
>> @@ -0,0 +1,21 @@
>> +AC_DEFUN([AM_ZSTD],
>
>This file would need a copyright header.  You could copy the one from
>elf.m4, for instance.  Can you also add a one-line comment to explain
>what the macro does (check for the zstd library)?

Added.

I removed PKG_PROG_PKG_CONFIG and moved PKG_PROG_PKG_CONFIG in ld/configure.ac.
PKG_PROG_PKG_CONFIG increases the lines in configure, so I get the idea
we should minimize PKG_PROG_PKG_CONFIG in *.m4 files.

>> +[
>> +AC_ARG_WITH(zstd,
>> +  [AS_HELP_STRING([--with-zstd], [support zstd compressed debug sections (default=auto)])],
>> +  [], [with_zstd=auto])
>> +AC_MSG_CHECKING([whether to use zstd])
>> +AC_MSG_RESULT([$with_zstd])
>
>Ah, I see what you mean by missing AC_MSG_CHECKING and AC_MSG_RESULT.
>In my opinion, if the user passes --without-zstd, we don't need to print
>a message about zstd.  But whatever we choose, it would be nice to try
>to keep consistent.

Thanks.  Removed AC_MSG_CHECKING and AC_MSG_RESULT.  I think you are
right that they are not very useful.

>> +
>> +if test "$with_zstd" != no; then
>> +  PKG_PROG_PKG_CONFIG
>> +  PKG_CHECK_MODULES(ZSTD, [libzstd], [
>> +    AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled])
>> +    AC_SUBST([ZSTD_CFLAGS])
>> +    AC_SUBST([ZSTD_LIBS])
>
>I think you don't need these AC_SUBST, PKG_CHECK_MODULES does it for
>you.

Removed.


More information about the Binutils mailing list