Openwrt/package/devel/binutils/patches/0002-When-building-target-binaries-ensure-that-the-warnin.patch
Hauke Mehrtens efb22b6f06 binutils: fix build with host gcc < 4.9
binutils 2.27 checks if the target compiler supports -Wstack-
usage=262144, and also uses this setting for the host compiler. If the
host compiler is gcc < 4.9 binutils build will fail. This backports 2
commits which are fixing this problem for binutils 2.28.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2017-04-12 09:54:39 +02:00

1259 lines
40 KiB
Diff

From b8ff24c72174effd5c5527866313982e28507275 Mon Sep 17 00:00:00 2001
From: Vlad Zakharov <vzakhar@synopsys.com>
Date: Mon, 26 Sep 2016 16:36:08 +0100
Subject: [PATCH 2/2] When building target binaries, ensure that the warning
flags selected for the command line match the target compiler.
bfd * warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro
to verify CC_FOR_BUILD compiler.
(AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable
and add CC_FOR_BUILD compiler checks.
* Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.
binutils * Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD
when building with CC_FOR_BUILD compiler.
* Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.
gas * Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.
gold * Makefile.in: Regenerate.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.
gprof * Makefile.in: Regenerate.
* configure: Likewise.
ld * Makefile.in: Regenerate.
* configure: Likewise.
opcodes * Makefile.in: Regenerate.
* configure: Likewise.
---
bfd/Makefile.in | 1 +
bfd/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
bfd/doc/Makefile.in | 1 +
bfd/warning.m4 | 47 ++++++++++++++++++++++++++++++++++----
binutils/Makefile.am | 10 +++++----
binutils/Makefile.in | 10 +++++----
binutils/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
binutils/doc/Makefile.in | 1 +
gas/Makefile.in | 1 +
gas/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
gas/doc/Makefile.in | 1 +
gold/Makefile.in | 5 +++--
gold/configure | 52 ++++++++++++++++++++++++++++++++++++++----
gold/testsuite/Makefile.in | 1 +
gprof/Makefile.in | 1 +
gprof/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
ld/Makefile.in | 3 ++-
ld/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
opcodes/Makefile.in | 1 +
opcodes/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
20 files changed, 416 insertions(+), 55 deletions(-)
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -288,6 +288,7 @@ TDEFINES = @TDEFINES@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
abs_builddir = @abs_builddir@
--- a/bfd/configure
+++ b/bfd/configure
@@ -659,6 +659,7 @@ MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
REPORT_BUGS_TEXI
REPORT_BUGS_TO
@@ -11427,7 +11428,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11430 "configure"
+#line 11431 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11533,7 +11534,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11536 "configure"
+#line 11537 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12240,8 +12241,12 @@ fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12286,6 +12291,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -12301,6 +12336,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -12314,25 +12350,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -12343,6 +12386,7 @@ fi
+
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -248,6 +248,7 @@ TDEFINES = @TDEFINES@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
abs_builddir = @abs_builddir@
--- a/bfd/warning.m4
+++ b/bfd/warning.m4
@@ -17,12 +17,34 @@ dnl along with this program; see the fil
dnl <http://www.gnu.org/licenses/>.
dnl
+# AC_EGREP_CPP_FOR_BUILD(PATTERN, PROGRAM,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# ------------------------------------------------------
+AC_DEFUN([AC_EGREP_CPP_FOR_BUILD],
+[AC_LANG_PREPROC_REQUIRE()dnl
+AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
+AS_IF([dnl eval is necessary to expand ac_cpp.
+dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
+(eval "$ac_cpp_for_build conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+dnl Quote $1 to prevent m4 from eating character classes
+ $EGREP "[$1]" >/dev/null 2>&1],
+ [$3],
+ [$4])
+rm -f conftest*
+])# AC_EGREP_CPP_FOR_BUILD
+
+
AC_DEFUN([AM_BINUTILS_WARNINGS],[
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
@@ -34,6 +56,14 @@ AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_W
WARN_WRITE_STRINGS=""
AC_EGREP_CPP([^[0-3]$],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-strings")
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+AC_EGREP_CPP_FOR_BUILD([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow")
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+AC_EGREP_CPP_FOR_BUILD([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144")
+
AC_ARG_ENABLE(werror,
[ --enable-werror treat compile warnings as errors],
[case "${enableval}" in
@@ -47,6 +77,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -60,25 +91,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings enable build-time compiler warnings],
[case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac])
if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
@@ -86,6 +124,7 @@ if test x"$silent" != x"yes" && test x"$
fi
AC_SUBST(WARN_CFLAGS)
+AC_SUBST(WARN_CFLAGS_FOR_BUILD)
AC_SUBST(NO_WERROR)
AC_SUBST(WARN_WRITE_STRINGS)
])
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -47,8 +47,10 @@ ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
NO_WERROR = @NO_WERROR@
AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
LIBICONV = @LIBICONV@
# these two are almost the same program
@@ -305,17 +307,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
sysinfo.@OBJEXT@: sysinfo.c
if [ -r sysinfo.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
else \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
fi
bin2c$(EXEEXT_FOR_BUILD): bin2c.c
- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
+ $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
embedspu: embedspu.sh Makefile
awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -401,6 +401,7 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
@@ -478,6 +479,7 @@ am__skipyacc =
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
# these two are almost the same program
AR_PROG = ar
@@ -1370,17 +1372,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
+ $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
sysinfo.@OBJEXT@: sysinfo.c
if [ -r sysinfo.c ]; then \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
else \
- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
+ $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
fi
bin2c$(EXEEXT_FOR_BUILD): bin2c.c
- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
+ $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
embedspu: embedspu.sh Makefile
awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
--- a/binutils/configure
+++ b/binutils/configure
@@ -652,6 +652,7 @@ YFLAGS
YACC
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
OTOOL64
OTOOL
@@ -11225,7 +11226,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11228 "configure"
+#line 11229 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11331,7 +11332,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11334 "configure"
+#line 11335 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11945,8 +11946,12 @@ _ACEOF
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11991,6 +11996,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -12006,6 +12041,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -12019,25 +12055,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -12048,6 +12091,7 @@ fi
+
--- a/binutils/doc/Makefile.in
+++ b/binutils/doc/Makefile.in
@@ -249,6 +249,7 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
YACC = @YACC@
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -255,6 +255,7 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
--- a/gas/configure
+++ b/gas/configure
@@ -642,6 +642,7 @@ cgen_cpu_prefix
GDBINIT
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
OTOOL64
OTOOL
@@ -10985,7 +10986,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10988 "configure"
+#line 10989 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11091,7 +11092,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11094 "configure"
+#line 11095 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11721,8 +11722,12 @@ using_cgen=no
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11767,6 +11772,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -11782,6 +11817,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -11795,25 +11831,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -11824,6 +11867,7 @@ fi
+
--- a/gas/doc/Makefile.in
+++ b/gas/doc/Makefile.in
@@ -230,6 +230,7 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
YACC = @YACC@
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -87,8 +87,8 @@ subdir = .
DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(srcdir)/config.in \
- $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in \
- ftruncate.c pread.c mremap.c ffsll.c yyscript.h yyscript.c \
+ $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
+ mremap.c ftruncate.c pread.c yyscript.h yyscript.c \
$(srcdir)/../depcomp $(srcdir)/../ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
@@ -409,6 +409,7 @@ TARGETOBJS = @TARGETOBJS@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_CXXFLAGS = @WARN_CXXFLAGS@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
--- a/gold/configure
+++ b/gold/configure
@@ -609,6 +609,7 @@ GOLD_LDFLAGS
WARN_CXXFLAGS
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
IFUNC_STATIC_FALSE
IFUNC_STATIC_TRUE
@@ -6723,8 +6724,12 @@ fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6769,6 +6774,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -6784,6 +6819,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -6797,25 +6833,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -6826,6 +6869,7 @@ fi
+
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -2568,6 +2568,7 @@ TARGETOBJS = @TARGETOBJS@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_CXXFLAGS = @WARN_CXXFLAGS@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
--- a/gprof/Makefile.in
+++ b/gprof/Makefile.in
@@ -267,6 +267,7 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
abs_builddir = @abs_builddir@
--- a/gprof/configure
+++ b/gprof/configure
@@ -604,6 +604,7 @@ LTLIBOBJS
LIBOBJS
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
GENINSRC_NEVER_FALSE
GENINSRC_NEVER_TRUE
@@ -10901,7 +10902,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10904 "configure"
+#line 10905 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11007,7 +11008,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11010 "configure"
+#line 11011 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12101,8 +12102,12 @@ fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12147,6 +12152,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -12162,6 +12197,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -12175,25 +12211,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -12204,6 +12247,7 @@ fi
+
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -354,6 +354,7 @@ TESTBFDLIB = @TESTBFDLIB@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
@@ -508,7 +509,7 @@ CXX_FOR_TARGET = ` \
fi`
-# Strip out sanitization options as they require special host libraries.
+# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
info_TEXINFOS = ld.texinfo
--- a/ld/configure
+++ b/ld/configure
@@ -646,6 +646,7 @@ LIBINTL
USE_NLS
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
installed_linker
install_as_default
@@ -11723,7 +11724,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11726 "configure"
+#line 11727 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11829,7 +11830,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11832 "configure"
+#line 11833 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15558,8 +15559,12 @@ fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -15604,6 +15609,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -15619,6 +15654,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -15632,25 +15668,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -15661,6 +15704,7 @@ fi
+
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -267,6 +267,7 @@ STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_CFLAGS = @WARN_CFLAGS@
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
XGETTEXT = @XGETTEXT@
abs_builddir = @abs_builddir@
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -643,6 +643,7 @@ MAINTAINER_MODE_TRUE
NO_WMISSING_FIELD_INITIALIZERS
WARN_WRITE_STRINGS
NO_WERROR
+WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
OTOOL64
OTOOL
@@ -11150,7 +11151,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11153 "configure"
+#line 11154 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11256,7 +11257,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11259 "configure"
+#line 11260 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11508,8 +11509,12 @@ fi
# Set the 'development' global.
. $srcdir/../bfd/development.sh
+# Set acp_cpp_for_build variable
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
+
# Default set of GCC warnings to enable.
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11554,6 +11559,36 @@ fi
rm -f conftest*
+# Verify CC_FOR_BUILD to be compatible with waring flags
+
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-3]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
+fi
+rm -f conftest*
+
+
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__GNUC__
+_ACEOF
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
+ $EGREP "^[0-4]$" >/dev/null 2>&1; then :
+
+else
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
+fi
+rm -f conftest*
+
+
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror; case "${enableval}" in
@@ -11569,6 +11604,7 @@ case "${host}" in
*-*-mingw32*)
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
fi
;;
*) ;;
@@ -11582,25 +11618,32 @@ fi
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
+ GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
NO_WERROR="-Wno-error"
fi
if test "${GCC}" = yes ; then
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
fi
# Check whether --enable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then :
enableval=$enable_build_warnings; case "${enableval}" in
- yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
+ yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
no) if test "${GCC}" = yes ; then
WARN_CFLAGS="-w"
+ WARN_CFLAGS_FOR_BUILD="-w"
fi;;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
+ WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
+ WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
- *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
+ WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
+ *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
+ WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
fi
@@ -11611,6 +11654,7 @@ fi
+
ac_ext=c