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

Simon Marchi simark@simark.ca
Tue Sep 20 01:11:18 GMT 2022


On 9/19/22 12:45, Fangrui Song via Gdb-patches wrote:
> 
> On 2022-09-19, Simon Marchi wrote:
>>> I am unfamilir with autotools, but I agree that pkg-config is better.  Changed to PKG_CHECK_MODULES
>>> and pushed the change to
>>> https://gitlab.com/MaskRay/binutils-gdb/-/commits/zstd
>>
>> Thanks, I'll take a proper look when you post a v2.
>>
>>> However, now `make all-gdb` fails to link because gdb/Makefile does not have `ZSTD_LIBS = -lzstd` ...
>>
>> For GDB, you can copy what we do for debuginfod in gdb/Makefile.in,
>> which would mean:
>>
>> ZSTD_CFLAGS = @ZSTD_CFLAGS@
>> ZSTD_LIBS = @ZSTD_LIBS@
>>
>> And use $(ZSTD_CFLAGS) and $(ZSTD_LIBS) where appropriate.
>>
>> Simon
> 
> Thanks, the ZSTD_CFLAGS tip helped.  I inspected jansson and msgpack's
> pkg-config check and get this v2 patch:
> https://sourceware.org/pipermail/binutils/2022-September/122950.html
> 
> Note: For some reasons I have to include PKG_PROG_PKG_CONFIG in
> config/zstd.m4, otherwise pkg-config does not work for some directories.

It's probably because of this (from the documentation of
PKG_CHECK_MODULES):

   dnl Note that if there is a possibility the first call to
   dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
   dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac

I hit that problem when adding another PKG_CHECK_MODULES call in a
downstream port.  The pkg-config tool is probed only by the first
PKG_CHECK_MODULES instance that appears in the source.  So if it's
possible this check does not happen (because of a condition), then
pkg-config is never probed for, so the second instance of
PKG_CHECK_MODULES thinks pkg-config is not available.

In my downstream port, I made each configure.ac call
PKG_PROG_PKG_CONFIG.  But if what you did works, I'm fine with it.

> Note: PKG_CHECK_MODULES(MSGPACK in binutils/configure.ac possibly misses
> AC_MSG_CHECKING/AC_MSG_RESULT, so when msgpack is missing, the log isn't
> clear.

I think they are done by PKG_CHECK_MODULES, aren't they?  I see:

checking for msgpack... no

Simon



More information about the Binutils mailing list