[PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS
Simon Marchi
simon.marchi@efficios.com
Mon Nov 15 16:08:52 GMT 2021
Ping.
On 2021-11-02 2:35 p.m., Simon Marchi wrote:
> I build debuginfod manually and install it under /opt/debuginfod, then
> use:
>
> $ export PKG_CONFIG_PATH=/opt/debuginfod/lib/pkgconfig
>
> ... to have the build system find the library. It finds it fine, but
> then DEBUGINFOD_CFLAGS is not passed anywhere, which results in:
>
> $ make V=1 dwarf.o
> depbase=`echo dwarf.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> ccache gcc-11 -DHAVE_CONFIG_H -I. -I/home/smarchi/src/binutils-gdb/binutils -I. -I/home/smarchi/src/binutils-gdb/binutils -I../bfd -I/home/smarchi/src/binutils-gdb/binutils/../bfd -I/home/smarchi/src/binutils-gdb/binutils/../include -DLOCALEDIR="\"/usr/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I/home/smarchi/src/binutils-gdb/binutils/../zlib -g3 -O0 -fdiagnostics-color=always -fmax-errors=1 -fsanitize=address -MT dwarf.o -MD -MP -MF $depbase.Tpo -c -o dwarf.o /home/smarchi/src/binutils-gdb/binutils/dwarf.c &&\
> mv -f $depbase.Tpo $depbase.Po
> /home/smarchi/src/binutils-gdb/binutils/dwarf.c:36:10: fatal error: elfutils/debuginfod.h: No such file or directory
> 36 | #include <elfutils/debuginfod.h>
> | ^~~~~~~~~~~~~~~~~~~~~~~
>
> I presume that everybody using debuginfod has it in a default include
> path, or puts the right -I in CFLAGS. But that should not be necessary
> with pkg-config.
>
> Fix this by putting DEBUGINFOD_CFLAGS in AM_CFLAGS. I think it would be
> a bit better to only include DEBUGINFOD_CFLAGS in readelf's and
> objdump's CFLAGS, but I couldn't get that to work, because of the
> special build rule for objdump.c (if somebody wants to try it, please go
> ahead).
>
> binutils/ChangeLog:
>
> * Makefile.am (DEBUGINFOD_CFLAGS): New.
> (DEBUGINFOD_LIBS): Move up.
> (AM_CFLAGS): Add DEBUGINFOD_CFLAGS.
>
> Change-Id: Ic92eeb3277e51f3b4ce650750d3fe4c10e097a15
> ---
> binutils/Makefile.am | 7 ++++---
> binutils/Makefile.in | 2 +-
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/binutils/Makefile.am b/binutils/Makefile.am
> index 00416cb635e..93cf85a9034 100644
> --- a/binutils/Makefile.am
> +++ b/binutils/Makefile.am
> @@ -46,15 +46,16 @@ am__skipyacc =
> ZLIB = @zlibdir@ -lz
> ZLIBINC = @zlibinc@
>
> +DEBUGINFOD_CFLAGS = @DEBUGINFOD_CFLAGS@
> +DEBUGINFOD_LIBS = @DEBUGINFOD_LIBS@
> +
> WARN_CFLAGS = @WARN_CFLAGS@
> WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
> NO_WERROR = @NO_WERROR@
> -AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
> +AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(DEBUGINFOD_CFLAGS)
> AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
> LIBICONV = @LIBICONV@
>
> -DEBUGINFOD_LIBS = @DEBUGINFOD_LIBS@
> -
> # these two are almost the same program
> AR_PROG=ar
> RANLIB_PROG=ranlib
> diff --git a/binutils/Makefile.in b/binutils/Makefile.in
> index bed8fef64d8..5664d65078c 100644
> --- a/binutils/Makefile.in
> +++ b/binutils/Makefile.in
> @@ -582,7 +582,7 @@ am__skipyacc =
> # case both are empty.
> ZLIB = @zlibdir@ -lz
> ZLIBINC = @zlibinc@
> -AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
> +AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(DEBUGINFOD_CFLAGS)
> AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
>
> # these two are almost the same program
> --
> 2.33.0
>
More information about the Binutils
mailing list