diff options
author | Vlad Zakharov <vzakhar@synopsys.com> | 2016-09-26 16:36:08 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-09-26 16:36:08 +0100 |
commit | c5da193232ea0452f714dffee0d417d965590476 (patch) | |
tree | c2867b21c7ceff96ce501c83c1e99025a55d5ba3 /gold | |
parent | 384f7503344b1d07561f801ced7493858cde6164 (diff) | |
download | gdb-c5da193232ea0452f714dffee0d417d965590476.zip gdb-c5da193232ea0452f714dffee0d417d965590476.tar.gz gdb-c5da193232ea0452f714dffee0d417d965590476.tar.bz2 |
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.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 6 | ||||
-rw-r--r-- | gold/Makefile.in | 5 | ||||
-rwxr-xr-x | gold/configure | 52 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 1 |
4 files changed, 58 insertions, 6 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 6939b5b..d791d29 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2016-09-26 Vlad Zakharov <vzakhar@synopsys.com> + + * Makefile.in: Regenerate. + * configure: Likewise. + * testsuite/Makefile.in: Likewise. + 2016-09-26 Alan Modra <amodra@gmail.com> * aarch64.cc (Target_aarch64::is_erratum_835769_sequence): Avoid diff --git a/gold/Makefile.in b/gold/Makefile.in index ec67448..98ab28e 100644 --- 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@ diff --git a/gold/configure b/gold/configure index 8240c28..343a407 100755 --- 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 @@ -6829,6 +6872,7 @@ fi + WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'` diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index f55aee8..a200540 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -2588,6 +2588,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@ |