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 /binutils | |
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 'binutils')
-rw-r--r-- | binutils/ChangeLog | 8 | ||||
-rw-r--r-- | binutils/Makefile.am | 10 | ||||
-rw-r--r-- | binutils/Makefile.in | 10 | ||||
-rwxr-xr-x | binutils/configure | 56 | ||||
-rw-r--r-- | binutils/doc/Makefile.in | 1 |
5 files changed, 71 insertions, 14 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0b4d1a5..1b9cb24 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,11 @@ +2016-09-26 Vlad Zakharov <vzakhar@synopsys.com> + + * 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. + 2016-09-26 Alan Modra <amodra@gmail.com> * readelf.c (display_power_gnu_attribute): Catch truncated section diff --git a/binutils/Makefile.am b/binutils/Makefile.am index 18af2c8..ef17914 100644 --- 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.@OBJEXT@ syslex_wrap.@OBJEXT@ $(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}' < $< > $@ diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 215ff70..5b62333 100644 --- 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.@OBJEXT@ syslex_wrap.@OBJEXT@ $(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}' < $< > $@ diff --git a/binutils/configure b/binutils/configure index 79dcbd0..610d07e 100755 --- 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 @@ -12051,6 +12094,7 @@ fi + ac_config_headers="$ac_config_headers config.h:config.in" diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in index ea3f938..8d9fc2d 100644 --- 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@ |