* [PATCH 0/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirectories
@ 2022-09-15 5:59 Tsukasa OI
2022-09-15 5:59 ` [PATCH 1/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirs Tsukasa OI
0 siblings, 1 reply; 4+ messages in thread
From: Tsukasa OI @ 2022-09-15 5:59 UTC (permalink / raw)
To: Tsukasa OI, Nick Clifton, Jim Wilson; +Cc: binutils
Hello,
While investigating previous -Wstack-usage=262144 removal (on Clang) patch,
I found something intresting.
cf. <https://sourceware.org/pipermail/binutils/2022-September/122817.html>
Here's some excerpt from "$(builddir)/bfd/config.log":
gcc: warning: @CPPFLAGS_FOR_BUILD@: linker input file unused because linking not done
gcc: error: @CPPFLAGS_FOR_BUILD@: linker input file not found: No such file or directory
gcc: warning: @CPPFLAGS_FOR_BUILD@: linker input file unused because linking not done
gcc: error: @CPPFLAGS_FOR_BUILD@: linker input file not found: No such file or directory
gcc: warning: @CPPFLAGS_FOR_BUILD@: linker input file unused because linking not done
gcc: error: @CPPFLAGS_FOR_BUILD@: linker input file not found: No such file or directory
This is because command like this is called:
gcc -E @CPPFLAGS_FOR_BUILD@ conftest.c
I found that this is because "$(build)/Makefile" passes CPPFLAGS_FOR_BUILD
environment variable without substituting with AC_SUBST
(should be placed in "$(srcdir)/configure.ac").
Here's excerpt from "$(builddir)/Makefile":
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
THIS IS NOT "$(srcdir)/Makefile.in" (it's normal in Makefile.in but should
be substituted while generating "$(builddir)/Makefile").
I searched similar examples and found that following environment variables
are unsubstituted in "$(builddir)/Makefile" AND possibly used in subdirs:
- CPPFLAGS_FOR_BUILD
- DSYMUTIL
- DSYMUTIL_FOR_BUILD
- DSYMUTIL_FOR_TARGET
- OTOOL
- OTOOL_FOR_TARGET
note:
There are other unsubstituted variables but I think they are not used by
any subdirectories.
At least, CPPFLAGS_FOR_BUILD can be tested on my own.
For that, I think this simple patch would work.
Request for Feedback (not a part of this patchset):
dsymutil and otool are macOS development tools (used by libtool). Since I
don't have any modern Mac, I don't want to touch them without testing.
I have a test commit "configure: pass OTOOL and DSYMUTIL to subdirs" in
my GitHub and can someone (who has real Mac machine) test it?
<https://github.com/a4lg/binutils-gdb/tree/config-pass-vars-to-children-dev>
Thanks,
Tsukasa
Tsukasa OI (1):
configure: Pass CPPFLAGS_FOR_BUILD to subdirs
configure | 3 +++
configure.ac | 2 ++
2 files changed, 5 insertions(+)
base-commit: fe39ffdc202f04397f31557f17170b40bc42b77a
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirs
2022-09-15 5:59 [PATCH 0/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirectories Tsukasa OI
@ 2022-09-15 5:59 ` Tsukasa OI
2022-09-20 12:53 ` Nick Clifton
0 siblings, 1 reply; 4+ messages in thread
From: Tsukasa OI @ 2022-09-15 5:59 UTC (permalink / raw)
To: Tsukasa OI, Nick Clifton, Jim Wilson; +Cc: binutils
Because CPPFLAGS_FOR_BUILD is used in some subdirectories (through
bfd/warning.m4), not AC_SUBSTing the variable causes minor issues.
Fortunately, it didn't cause severe errors but error messages related to
@CPPFLAGS_FOR_BUILD@ (not AC_SUBSTed CPPFLAGS_FOR_BUILD variable passed
to subdirectories through Makefile) remain in config.log.
To avoid invalid invocation of preprocessor for build environment, we
need to set proper CPPFLAGS_FOR_BUILD (may be empty) and pass it to
subdirectories that need it. This is what this commit does.
ChangeLog:
* configure.ac: Pass CPPFLAGS_FOR_BUILD to subdirectories.
* configure: Regenerate.
---
configure | 3 +++
configure.ac | 2 ++
2 files changed, 5 insertions(+)
diff --git a/configure b/configure
index 16139e3bfa3..d75f47a1e95 100755
--- a/configure
+++ b/configure
@@ -651,6 +651,7 @@ GFORTRAN_FOR_BUILD
DLLTOOL_FOR_BUILD
CXX_FOR_BUILD
CXXFLAGS_FOR_BUILD
+CPPFLAGS_FOR_BUILD
CFLAGS_FOR_BUILD
CC_FOR_BUILD
AS_FOR_BUILD
@@ -8024,6 +8025,7 @@ esac
# our build compiler if desired.
if test x"${build}" = x"${host}" ; then
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
fi
@@ -8102,6 +8104,7 @@ done
+
# Generate default definitions for YACC, M4, LEX and other programs that run
# on the build machine. These are used if the Makefile can't locate these
# programs in objdir.
diff --git a/configure.ac b/configure.ac
index a5555a9c91b..ae18d436aca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3326,6 +3326,7 @@ esac
# our build compiler if desired.
if test x"${build}" = x"${host}" ; then
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
+ CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
fi
@@ -3392,6 +3393,7 @@ AC_SUBST(AR_FOR_BUILD)
AC_SUBST(AS_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
+AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(CXXFLAGS_FOR_BUILD)
AC_SUBST(CXX_FOR_BUILD)
AC_SUBST(DLLTOOL_FOR_BUILD)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirs
2022-09-15 5:59 ` [PATCH 1/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirs Tsukasa OI
@ 2022-09-20 12:53 ` Nick Clifton
2022-09-21 5:56 ` Tsukasa OI
0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2022-09-20 12:53 UTC (permalink / raw)
To: Tsukasa OI, Jim Wilson; +Cc: binutils
Hi Tsukasa,
> ChangeLog:
>
> * configure.ac: Pass CPPFLAGS_FOR_BUILD to subdirectories.
> * configure: Regenerate.
Patch approved - please apply.
Note - you may wish to submit a copy of this patch to the gcc-patches
mailing list as well, since gcc and binutils/gdb try to share the top
level configure files.
Cheers
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirs
2022-09-20 12:53 ` Nick Clifton
@ 2022-09-21 5:56 ` Tsukasa OI
0 siblings, 0 replies; 4+ messages in thread
From: Tsukasa OI @ 2022-09-21 5:56 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
On 2022/09/20 21:53, Nick Clifton wrote:
> Hi Tsukasa,
>
>> ChangeLog:
>>
>> * configure.ac: Pass CPPFLAGS_FOR_BUILD to subdirectories.
>> * configure: Regenerate.
> Patch approved - please apply.
>
> Note - you may wish to submit a copy of this patch to the gcc-patches
> mailing list as well, since gcc and binutils/gdb try to share the top
> level configure files.
>
> Cheers
> Nick
>
>
Hi Nick,
I found that GCC already has a superset of this patch.
Commit 84401ce5fb4e ("[PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS
is used for build targets") is the one.
I will commit my patchset as is (because this is sufficient to resolve
Binutils side issue) but also will seek an opportunity to sync with this
when I revisit configure scripts again (currently, I'm working on RISC-V
(various parts) and disassembler improvements on Arm and AArch64).
Thanks,
Tsukasa
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-21 5:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 5:59 [PATCH 0/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirectories Tsukasa OI
2022-09-15 5:59 ` [PATCH 1/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirs Tsukasa OI
2022-09-20 12:53 ` Nick Clifton
2022-09-21 5:56 ` Tsukasa OI
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).