* [PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS
@ 2021-11-02 18:35 Simon Marchi
2021-11-15 16:08 ` Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-11-02 18:35 UTC (permalink / raw)
To: binutils; +Cc: Simon Marchi
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS
2021-11-02 18:35 [PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS Simon Marchi
@ 2021-11-15 16:08 ` Simon Marchi
2021-11-17 4:44 ` Alan Modra
0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-11-15 16:08 UTC (permalink / raw)
To: binutils
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS
2021-11-15 16:08 ` Simon Marchi
@ 2021-11-17 4:44 ` Alan Modra
2021-11-17 15:12 ` Simon Marchi
0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2021-11-17 4:44 UTC (permalink / raw)
To: Simon Marchi; +Cc: binutils
On Mon, Nov 15, 2021 at 11:08:52AM -0500, Simon Marchi via Binutils wrote:
> Ping.
I can't say I like it, admittedly mostly because you're putting a
thing named *_CFLAGS into AM_CFLAGS. If it was only -I options and
guaranteed to stay that way I'd be happier, but the potiential for
someone to put other options in DEBUGINFOD_CFLAGS worries me.
> > 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).
Does the following work for you?
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 7f4c24c213b..ee2a66302cd 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -46,6 +46,9 @@ 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@
@@ -53,8 +56,6 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
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
@@ -366,6 +367,18 @@ endif
$(COMPILE) -c `test -f arlex.c || echo $(srcdir)/`arlex.c $(NO_WERROR)
endif
+dwarf.@OBJEXT@: dwarf.c
+if am__fastdepCC
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo $(DEBUGINFOD_CFLAGS) -c -o $@ $(srcdir)/dwarf.c
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+else
+if AMDEP
+ source='dwarf.c' object='$@' libtool=no @AMDEPBACKSLASH@
+ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+endif
+ $(COMPILE) $(DEBUGINFOD_CFLAGS) -c -o $@ $(srcdir)/dwarf.c
+endif
+
sysroff.@OBJEXT@: sysroff.c
if am__fastdepCC
$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f sysroff.c || echo $(srcdir)/`sysroff.c $(NO_WERROR)
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 5252ef18b5c..8f44b566725 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -1530,6 +1530,13 @@ arlex.@OBJEXT@: arlex.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f arlex.c || echo $(srcdir)/`arlex.c $(NO_WERROR)
+dwarf.@OBJEXT@: dwarf.c
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo $(DEBUGINFOD_CFLAGS) -c -o $@ $(srcdir)/dwarf.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dwarf.c' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) $(DEBUGINFOD_CFLAGS) -c -o $@ $(srcdir)/dwarf.c
+
sysroff.@OBJEXT@: sysroff.c
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f sysroff.c || echo $(srcdir)/`sysroff.c $(NO_WERROR)
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS
2021-11-17 4:44 ` Alan Modra
@ 2021-11-17 15:12 ` Simon Marchi
0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2021-11-17 15:12 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
On 2021-11-16 11:44 p.m., Alan Modra wrote:
> On Mon, Nov 15, 2021 at 11:08:52AM -0500, Simon Marchi via Binutils wrote:
>> Ping.
>
> I can't say I like it, admittedly mostly because you're putting a
> thing named *_CFLAGS into AM_CFLAGS. If it was only -I options and
> guaranteed to stay that way I'd be happier, but the potiential for
> someone to put other options in DEBUGINFOD_CFLAGS worries me.
>
>>> 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).
>
> Does the following work for you?
It works, yes. So if it's more in-line with how things are done in binutils,
this is fine with me, thanks!
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-17 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 18:35 [PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS Simon Marchi
2021-11-15 16:08 ` Simon Marchi
2021-11-17 4:44 ` Alan Modra
2021-11-17 15:12 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).