[PATCH] binutils: put DEBUGINFOD_CFLAGS in AM_CFLAGS

Alan Modra amodra@gmail.com
Wed Nov 17 04:44:04 GMT 2021


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


More information about the Binutils mailing list