Re: [PATCH] Fix GDB build: ELF support check & -lzstd (was: Re: [PATCH v3] binutils, gdb: support zstd compressed debug sections)

Pedro Alves
2022-09-28T19:28:01Z

On 2022-09-28 8:00 p.m., Simon Marchi wrote:
> On 9/28/22 07:52, Pedro Alves wrote:

>> Note how above, in the gcc command line, "-lzstd" appears before
>> "-lbfd". That explain the link failure. It should appear after, like
>> -lz does.
>>
>> This commit fixes it, by moving ZSTD_LIBS from LDFLAGS to LIBS, next
>> to -lz, in GDB_AC_CHECK_BFD, and regenerating gdb/configure.
>>
>> Change-Id: I1f4128dde634e8ea04c9002904f1005a8b3a6863
>> ---
>> gdb/acinclude.m4 | 4 ++--
>> gdb/configure | 8 ++++----
>> 2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
>> index 28846119dcb..62fa66c7af3 100644
>> --- a/gdb/acinclude.m4
>> +++ b/gdb/acinclude.m4
>> @@ -234,9 +234,9 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [
>> # always want our bfd.
>> CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
>> ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
>> - LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS"
>> + LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
>> intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
>> - LIBS="-lbfd -liberty -lz $intl $LIBS"
>> + LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS"
>> AC_CACHE_CHECK(
>> [$1],
>> [$2],
>
> LGTM. Someone opened a bug about this:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=29630

Thanks. I added a Bug: tag and pushed it.