b87c58ec77d4877e2d58a3e0dac44b6081ef30c0
[openwrt/openwrt.git] / package / devel / binutils / patches / 0002-When-building-target-binaries-ensure-that-the-warnin.patch
1 From b8ff24c72174effd5c5527866313982e28507275 Mon Sep 17 00:00:00 2001
2 From: Vlad Zakharov <vzakhar@synopsys.com>
3 Date: Mon, 26 Sep 2016 16:36:08 +0100
4 Subject: [PATCH 2/2] When building target binaries, ensure that the warning
5 flags selected for the command line match the target compiler.
6
7 bfd * warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro
8 to verify CC_FOR_BUILD compiler.
9 (AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable
10 and add CC_FOR_BUILD compiler checks.
11 * Makefile.in: Regenerate.
12 * configure: Likewise.
13 * doc/Makefile.in: Likewise.
14
15 binutils * Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD
16 when building with CC_FOR_BUILD compiler.
17 * Makefile.in: Regenerate.
18 * configure: Likewise.
19 * doc/Makefile.in: Likewise.
20
21 gas * Makefile.in: Regenerate.
22 * configure: Likewise.
23 * doc/Makefile.in: Likewise.
24
25 gold * Makefile.in: Regenerate.
26 * configure: Likewise.
27 * testsuite/Makefile.in: Likewise.
28
29 gprof * Makefile.in: Regenerate.
30 * configure: Likewise.
31
32 ld * Makefile.in: Regenerate.
33 * configure: Likewise.
34
35 opcodes * Makefile.in: Regenerate.
36 * configure: Likewise.
37 ---
38 bfd/Makefile.in | 1 +
39 bfd/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
40 bfd/doc/Makefile.in | 1 +
41 bfd/warning.m4 | 47 ++++++++++++++++++++++++++++++++++----
42 binutils/Makefile.am | 10 +++++----
43 binutils/Makefile.in | 10 +++++----
44 binutils/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
45 binutils/doc/Makefile.in | 1 +
46 gas/Makefile.in | 1 +
47 gas/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
48 gas/doc/Makefile.in | 1 +
49 gold/Makefile.in | 5 +++--
50 gold/configure | 52 ++++++++++++++++++++++++++++++++++++++----
51 gold/testsuite/Makefile.in | 1 +
52 gprof/Makefile.in | 1 +
53 gprof/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
54 ld/Makefile.in | 3 ++-
55 ld/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
56 opcodes/Makefile.in | 1 +
57 opcodes/configure | 56 +++++++++++++++++++++++++++++++++++++++++-----
58 20 files changed, 416 insertions(+), 55 deletions(-)
59
60 --- a/bfd/Makefile.in
61 +++ b/bfd/Makefile.in
62 @@ -288,6 +288,7 @@ TDEFINES = @TDEFINES@
63 USE_NLS = @USE_NLS@
64 VERSION = @VERSION@
65 WARN_CFLAGS = @WARN_CFLAGS@
66 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
67 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
68 XGETTEXT = @XGETTEXT@
69 abs_builddir = @abs_builddir@
70 --- a/bfd/configure
71 +++ b/bfd/configure
72 @@ -659,6 +659,7 @@ MAINTAINER_MODE_FALSE
73 MAINTAINER_MODE_TRUE
74 WARN_WRITE_STRINGS
75 NO_WERROR
76 +WARN_CFLAGS_FOR_BUILD
77 WARN_CFLAGS
78 REPORT_BUGS_TEXI
79 REPORT_BUGS_TO
80 @@ -11427,7 +11428,7 @@ else
81 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
82 lt_status=$lt_dlunknown
83 cat > conftest.$ac_ext <<_LT_EOF
84 -#line 11430 "configure"
85 +#line 11431 "configure"
86 #include "confdefs.h"
87
88 #if HAVE_DLFCN_H
89 @@ -11533,7 +11534,7 @@ else
90 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
91 lt_status=$lt_dlunknown
92 cat > conftest.$ac_ext <<_LT_EOF
93 -#line 11536 "configure"
94 +#line 11537 "configure"
95 #include "confdefs.h"
96
97 #if HAVE_DLFCN_H
98 @@ -12240,8 +12241,12 @@ fi
99 # Set the 'development' global.
100 . $srcdir/../bfd/development.sh
101
102 +# Set acp_cpp_for_build variable
103 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
104 +
105 # Default set of GCC warnings to enable.
106 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
107 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
108
109 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
110 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
111 @@ -12286,6 +12291,36 @@ fi
112 rm -f conftest*
113
114
115 +# Verify CC_FOR_BUILD to be compatible with waring flags
116 +
117 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
118 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
119 +/* end confdefs.h. */
120 +__GNUC__
121 +_ACEOF
122 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
123 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
124 +
125 +else
126 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
127 +fi
128 +rm -f conftest*
129 +
130 +
131 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
132 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
133 +/* end confdefs.h. */
134 +__GNUC__
135 +_ACEOF
136 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
137 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
138 +
139 +else
140 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
141 +fi
142 +rm -f conftest*
143 +
144 +
145 # Check whether --enable-werror was given.
146 if test "${enable_werror+set}" = set; then :
147 enableval=$enable_werror; case "${enableval}" in
148 @@ -12301,6 +12336,7 @@ case "${host}" in
149 *-*-mingw32*)
150 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
151 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
152 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
153 fi
154 ;;
155 *) ;;
156 @@ -12314,25 +12350,32 @@ fi
157 NO_WERROR=
158 if test "${ERROR_ON_WARNING}" = yes ; then
159 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
160 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
161 NO_WERROR="-Wno-error"
162 fi
163
164 if test "${GCC}" = yes ; then
165 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
166 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
167 fi
168
169 # Check whether --enable-build-warnings was given.
170 if test "${enable_build_warnings+set}" = set; then :
171 enableval=$enable_build_warnings; case "${enableval}" in
172 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
173 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
174 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
175 no) if test "${GCC}" = yes ; then
176 WARN_CFLAGS="-w"
177 + WARN_CFLAGS_FOR_BUILD="-w"
178 fi;;
179 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
180 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
181 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
182 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
183 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
184 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
185 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
186 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
187 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
188 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
189 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
190 esac
191 fi
192
193 @@ -12343,6 +12386,7 @@ fi
194
195
196
197 +
198
199
200
201 --- a/bfd/doc/Makefile.in
202 +++ b/bfd/doc/Makefile.in
203 @@ -248,6 +248,7 @@ TDEFINES = @TDEFINES@
204 USE_NLS = @USE_NLS@
205 VERSION = @VERSION@
206 WARN_CFLAGS = @WARN_CFLAGS@
207 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
208 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
209 XGETTEXT = @XGETTEXT@
210 abs_builddir = @abs_builddir@
211 --- a/bfd/warning.m4
212 +++ b/bfd/warning.m4
213 @@ -17,12 +17,34 @@ dnl along with this program; see the fil
214 dnl <http://www.gnu.org/licenses/>.
215 dnl
216
217 +# AC_EGREP_CPP_FOR_BUILD(PATTERN, PROGRAM,
218 +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
219 +# ------------------------------------------------------
220 +AC_DEFUN([AC_EGREP_CPP_FOR_BUILD],
221 +[AC_LANG_PREPROC_REQUIRE()dnl
222 +AC_REQUIRE([AC_PROG_EGREP])dnl
223 +AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
224 +AS_IF([dnl eval is necessary to expand ac_cpp.
225 +dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
226 +(eval "$ac_cpp_for_build conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
227 +dnl Quote $1 to prevent m4 from eating character classes
228 + $EGREP "[$1]" >/dev/null 2>&1],
229 + [$3],
230 + [$4])
231 +rm -f conftest*
232 +])# AC_EGREP_CPP_FOR_BUILD
233 +
234 +
235 AC_DEFUN([AM_BINUTILS_WARNINGS],[
236 # Set the 'development' global.
237 . $srcdir/../bfd/development.sh
238
239 +# Set acp_cpp_for_build variable
240 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
241 +
242 # Default set of GCC warnings to enable.
243 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
244 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
245
246 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
247 AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
248 @@ -34,6 +56,14 @@ AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_W
249 WARN_WRITE_STRINGS=""
250 AC_EGREP_CPP([^[0-3]$],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-strings")
251
252 +# Verify CC_FOR_BUILD to be compatible with waring flags
253 +
254 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
255 +AC_EGREP_CPP_FOR_BUILD([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow")
256 +
257 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
258 +AC_EGREP_CPP_FOR_BUILD([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144")
259 +
260 AC_ARG_ENABLE(werror,
261 [ --enable-werror treat compile warnings as errors],
262 [case "${enableval}" in
263 @@ -47,6 +77,7 @@ case "${host}" in
264 *-*-mingw32*)
265 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
266 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
267 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
268 fi
269 ;;
270 *) ;;
271 @@ -60,25 +91,32 @@ fi
272 NO_WERROR=
273 if test "${ERROR_ON_WARNING}" = yes ; then
274 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
275 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
276 NO_WERROR="-Wno-error"
277 fi
278
279 if test "${GCC}" = yes ; then
280 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
281 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
282 fi
283
284 AC_ARG_ENABLE(build-warnings,
285 [ --enable-build-warnings enable build-time compiler warnings],
286 [case "${enableval}" in
287 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
288 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
289 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
290 no) if test "${GCC}" = yes ; then
291 WARN_CFLAGS="-w"
292 + WARN_CFLAGS_FOR_BUILD="-w"
293 fi;;
294 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
295 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
296 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
297 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
298 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
299 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
300 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
301 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
302 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
303 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
304 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
305 esac])
306
307 if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
308 @@ -86,6 +124,7 @@ if test x"$silent" != x"yes" && test x"$
309 fi
310
311 AC_SUBST(WARN_CFLAGS)
312 +AC_SUBST(WARN_CFLAGS_FOR_BUILD)
313 AC_SUBST(NO_WERROR)
314 AC_SUBST(WARN_WRITE_STRINGS)
315 ])
316 --- a/binutils/Makefile.am
317 +++ b/binutils/Makefile.am
318 @@ -47,8 +47,10 @@ ZLIB = @zlibdir@ -lz
319 ZLIBINC = @zlibinc@
320
321 WARN_CFLAGS = @WARN_CFLAGS@
322 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
323 NO_WERROR = @NO_WERROR@
324 AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
325 +AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
326 LIBICONV = @LIBICONV@
327
328 # these two are almost the same program
329 @@ -305,17 +307,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
330 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
331
332 syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
333 - $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
334 + $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
335
336 sysinfo.@OBJEXT@: sysinfo.c
337 if [ -r sysinfo.c ]; then \
338 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
339 + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
340 else \
341 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
342 + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
343 fi
344
345 bin2c$(EXEEXT_FOR_BUILD): bin2c.c
346 - $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
347 + $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
348
349 embedspu: embedspu.sh Makefile
350 awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
351 --- a/binutils/Makefile.in
352 +++ b/binutils/Makefile.in
353 @@ -401,6 +401,7 @@ STRIP = @STRIP@
354 USE_NLS = @USE_NLS@
355 VERSION = @VERSION@
356 WARN_CFLAGS = @WARN_CFLAGS@
357 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
358 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
359 XGETTEXT = @XGETTEXT@
360 YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
361 @@ -478,6 +479,7 @@ am__skipyacc =
362 ZLIB = @zlibdir@ -lz
363 ZLIBINC = @zlibinc@
364 AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
365 +AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
366
367 # these two are almost the same program
368 AR_PROG = ar
369 @@ -1370,17 +1372,17 @@ sysinfo$(EXEEXT_FOR_BUILD): sysinfo.@OBJ
370 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.@OBJEXT@ syslex_wrap.@OBJEXT@
371
372 syslex_wrap.@OBJEXT@: syslex_wrap.c syslex.c sysinfo.h config.h
373 - $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
374 + $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex_wrap.c
375
376 sysinfo.@OBJEXT@: sysinfo.c
377 if [ -r sysinfo.c ]; then \
378 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
379 + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
380 else \
381 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
382 + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
383 fi
384
385 bin2c$(EXEEXT_FOR_BUILD): bin2c.c
386 - $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
387 + $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c
388
389 embedspu: embedspu.sh Makefile
390 awk '/^program_transform_name=/ {print "program_transform_name=\"$(program_transform_name)\""; next} {print}' < $< > $@
391 --- a/binutils/configure
392 +++ b/binutils/configure
393 @@ -652,6 +652,7 @@ YFLAGS
394 YACC
395 WARN_WRITE_STRINGS
396 NO_WERROR
397 +WARN_CFLAGS_FOR_BUILD
398 WARN_CFLAGS
399 OTOOL64
400 OTOOL
401 @@ -11225,7 +11226,7 @@ else
402 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
403 lt_status=$lt_dlunknown
404 cat > conftest.$ac_ext <<_LT_EOF
405 -#line 11228 "configure"
406 +#line 11229 "configure"
407 #include "confdefs.h"
408
409 #if HAVE_DLFCN_H
410 @@ -11331,7 +11332,7 @@ else
411 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
412 lt_status=$lt_dlunknown
413 cat > conftest.$ac_ext <<_LT_EOF
414 -#line 11334 "configure"
415 +#line 11335 "configure"
416 #include "confdefs.h"
417
418 #if HAVE_DLFCN_H
419 @@ -11945,8 +11946,12 @@ _ACEOF
420 # Set the 'development' global.
421 . $srcdir/../bfd/development.sh
422
423 +# Set acp_cpp_for_build variable
424 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
425 +
426 # Default set of GCC warnings to enable.
427 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
428 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
429
430 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
431 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
432 @@ -11991,6 +11996,36 @@ fi
433 rm -f conftest*
434
435
436 +# Verify CC_FOR_BUILD to be compatible with waring flags
437 +
438 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
439 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
440 +/* end confdefs.h. */
441 +__GNUC__
442 +_ACEOF
443 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
444 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
445 +
446 +else
447 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
448 +fi
449 +rm -f conftest*
450 +
451 +
452 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
453 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
454 +/* end confdefs.h. */
455 +__GNUC__
456 +_ACEOF
457 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
458 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
459 +
460 +else
461 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
462 +fi
463 +rm -f conftest*
464 +
465 +
466 # Check whether --enable-werror was given.
467 if test "${enable_werror+set}" = set; then :
468 enableval=$enable_werror; case "${enableval}" in
469 @@ -12006,6 +12041,7 @@ case "${host}" in
470 *-*-mingw32*)
471 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
472 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
473 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
474 fi
475 ;;
476 *) ;;
477 @@ -12019,25 +12055,32 @@ fi
478 NO_WERROR=
479 if test "${ERROR_ON_WARNING}" = yes ; then
480 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
481 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
482 NO_WERROR="-Wno-error"
483 fi
484
485 if test "${GCC}" = yes ; then
486 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
487 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
488 fi
489
490 # Check whether --enable-build-warnings was given.
491 if test "${enable_build_warnings+set}" = set; then :
492 enableval=$enable_build_warnings; case "${enableval}" in
493 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
494 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
495 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
496 no) if test "${GCC}" = yes ; then
497 WARN_CFLAGS="-w"
498 + WARN_CFLAGS_FOR_BUILD="-w"
499 fi;;
500 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
501 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
502 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
503 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
504 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
505 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
506 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
507 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
508 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
509 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
510 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
511 esac
512 fi
513
514 @@ -12048,6 +12091,7 @@ fi
515
516
517
518 +
519
520
521
522 --- a/binutils/doc/Makefile.in
523 +++ b/binutils/doc/Makefile.in
524 @@ -249,6 +249,7 @@ STRIP = @STRIP@
525 USE_NLS = @USE_NLS@
526 VERSION = @VERSION@
527 WARN_CFLAGS = @WARN_CFLAGS@
528 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
529 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
530 XGETTEXT = @XGETTEXT@
531 YACC = @YACC@
532 --- a/gas/Makefile.in
533 +++ b/gas/Makefile.in
534 @@ -255,6 +255,7 @@ STRIP = @STRIP@
535 USE_NLS = @USE_NLS@
536 VERSION = @VERSION@
537 WARN_CFLAGS = @WARN_CFLAGS@ @WARN_WRITE_STRINGS@
538 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
539 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
540 XGETTEXT = @XGETTEXT@
541 YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
542 --- a/gas/configure
543 +++ b/gas/configure
544 @@ -642,6 +642,7 @@ cgen_cpu_prefix
545 GDBINIT
546 WARN_WRITE_STRINGS
547 NO_WERROR
548 +WARN_CFLAGS_FOR_BUILD
549 WARN_CFLAGS
550 OTOOL64
551 OTOOL
552 @@ -10985,7 +10986,7 @@ else
553 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
554 lt_status=$lt_dlunknown
555 cat > conftest.$ac_ext <<_LT_EOF
556 -#line 10988 "configure"
557 +#line 10989 "configure"
558 #include "confdefs.h"
559
560 #if HAVE_DLFCN_H
561 @@ -11091,7 +11092,7 @@ else
562 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
563 lt_status=$lt_dlunknown
564 cat > conftest.$ac_ext <<_LT_EOF
565 -#line 11094 "configure"
566 +#line 11095 "configure"
567 #include "confdefs.h"
568
569 #if HAVE_DLFCN_H
570 @@ -11721,8 +11722,12 @@ using_cgen=no
571 # Set the 'development' global.
572 . $srcdir/../bfd/development.sh
573
574 +# Set acp_cpp_for_build variable
575 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
576 +
577 # Default set of GCC warnings to enable.
578 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
579 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
580
581 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
582 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
583 @@ -11767,6 +11772,36 @@ fi
584 rm -f conftest*
585
586
587 +# Verify CC_FOR_BUILD to be compatible with waring flags
588 +
589 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
590 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
591 +/* end confdefs.h. */
592 +__GNUC__
593 +_ACEOF
594 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
595 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
596 +
597 +else
598 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
599 +fi
600 +rm -f conftest*
601 +
602 +
603 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
604 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
605 +/* end confdefs.h. */
606 +__GNUC__
607 +_ACEOF
608 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
609 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
610 +
611 +else
612 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
613 +fi
614 +rm -f conftest*
615 +
616 +
617 # Check whether --enable-werror was given.
618 if test "${enable_werror+set}" = set; then :
619 enableval=$enable_werror; case "${enableval}" in
620 @@ -11782,6 +11817,7 @@ case "${host}" in
621 *-*-mingw32*)
622 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
623 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
624 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
625 fi
626 ;;
627 *) ;;
628 @@ -11795,25 +11831,32 @@ fi
629 NO_WERROR=
630 if test "${ERROR_ON_WARNING}" = yes ; then
631 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
632 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
633 NO_WERROR="-Wno-error"
634 fi
635
636 if test "${GCC}" = yes ; then
637 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
638 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
639 fi
640
641 # Check whether --enable-build-warnings was given.
642 if test "${enable_build_warnings+set}" = set; then :
643 enableval=$enable_build_warnings; case "${enableval}" in
644 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
645 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
646 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
647 no) if test "${GCC}" = yes ; then
648 WARN_CFLAGS="-w"
649 + WARN_CFLAGS_FOR_BUILD="-w"
650 fi;;
651 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
652 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
653 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
654 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
655 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
656 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
657 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
658 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
659 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
660 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
661 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
662 esac
663 fi
664
665 @@ -11824,6 +11867,7 @@ fi
666
667
668
669 +
670
671
672
673 --- a/gas/doc/Makefile.in
674 +++ b/gas/doc/Makefile.in
675 @@ -230,6 +230,7 @@ STRIP = @STRIP@
676 USE_NLS = @USE_NLS@
677 VERSION = @VERSION@
678 WARN_CFLAGS = @WARN_CFLAGS@
679 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
680 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
681 XGETTEXT = @XGETTEXT@
682 YACC = @YACC@
683 --- a/gold/Makefile.in
684 +++ b/gold/Makefile.in
685 @@ -87,8 +87,8 @@ subdir = .
686 DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
687 $(srcdir)/Makefile.am $(top_srcdir)/configure \
688 $(am__configure_deps) $(srcdir)/config.in \
689 - $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in \
690 - ftruncate.c pread.c mremap.c ffsll.c yyscript.h yyscript.c \
691 + $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
692 + mremap.c ftruncate.c pread.c yyscript.h yyscript.c \
693 $(srcdir)/../depcomp $(srcdir)/../ylwrap
694 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
695 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
696 @@ -409,6 +409,7 @@ TARGETOBJS = @TARGETOBJS@
697 USE_NLS = @USE_NLS@
698 VERSION = @VERSION@
699 WARN_CFLAGS = @WARN_CFLAGS@
700 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
701 WARN_CXXFLAGS = @WARN_CXXFLAGS@
702 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
703 XGETTEXT = @XGETTEXT@
704 --- a/gold/configure
705 +++ b/gold/configure
706 @@ -609,6 +609,7 @@ GOLD_LDFLAGS
707 WARN_CXXFLAGS
708 WARN_WRITE_STRINGS
709 NO_WERROR
710 +WARN_CFLAGS_FOR_BUILD
711 WARN_CFLAGS
712 IFUNC_STATIC_FALSE
713 IFUNC_STATIC_TRUE
714 @@ -6723,8 +6724,12 @@ fi
715 # Set the 'development' global.
716 . $srcdir/../bfd/development.sh
717
718 +# Set acp_cpp_for_build variable
719 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
720 +
721 # Default set of GCC warnings to enable.
722 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
723 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
724
725 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
726 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
727 @@ -6769,6 +6774,36 @@ fi
728 rm -f conftest*
729
730
731 +# Verify CC_FOR_BUILD to be compatible with waring flags
732 +
733 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
734 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
735 +/* end confdefs.h. */
736 +__GNUC__
737 +_ACEOF
738 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
739 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
740 +
741 +else
742 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
743 +fi
744 +rm -f conftest*
745 +
746 +
747 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
748 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
749 +/* end confdefs.h. */
750 +__GNUC__
751 +_ACEOF
752 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
753 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
754 +
755 +else
756 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
757 +fi
758 +rm -f conftest*
759 +
760 +
761 # Check whether --enable-werror was given.
762 if test "${enable_werror+set}" = set; then :
763 enableval=$enable_werror; case "${enableval}" in
764 @@ -6784,6 +6819,7 @@ case "${host}" in
765 *-*-mingw32*)
766 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
767 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
768 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
769 fi
770 ;;
771 *) ;;
772 @@ -6797,25 +6833,32 @@ fi
773 NO_WERROR=
774 if test "${ERROR_ON_WARNING}" = yes ; then
775 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
776 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
777 NO_WERROR="-Wno-error"
778 fi
779
780 if test "${GCC}" = yes ; then
781 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
782 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
783 fi
784
785 # Check whether --enable-build-warnings was given.
786 if test "${enable_build_warnings+set}" = set; then :
787 enableval=$enable_build_warnings; case "${enableval}" in
788 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
789 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
790 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
791 no) if test "${GCC}" = yes ; then
792 WARN_CFLAGS="-w"
793 + WARN_CFLAGS_FOR_BUILD="-w"
794 fi;;
795 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
796 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
797 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
798 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
799 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
800 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
801 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
802 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
803 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
804 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
805 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
806 esac
807 fi
808
809 @@ -6826,6 +6869,7 @@ fi
810
811
812
813 +
814
815
816
817 --- a/gold/testsuite/Makefile.in
818 +++ b/gold/testsuite/Makefile.in
819 @@ -2568,6 +2568,7 @@ TARGETOBJS = @TARGETOBJS@
820 USE_NLS = @USE_NLS@
821 VERSION = @VERSION@
822 WARN_CFLAGS = @WARN_CFLAGS@
823 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
824 WARN_CXXFLAGS = @WARN_CXXFLAGS@
825 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
826 XGETTEXT = @XGETTEXT@
827 --- a/gprof/Makefile.in
828 +++ b/gprof/Makefile.in
829 @@ -267,6 +267,7 @@ STRIP = @STRIP@
830 USE_NLS = @USE_NLS@
831 VERSION = @VERSION@
832 WARN_CFLAGS = @WARN_CFLAGS@
833 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
834 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
835 XGETTEXT = @XGETTEXT@
836 abs_builddir = @abs_builddir@
837 --- a/gprof/configure
838 +++ b/gprof/configure
839 @@ -604,6 +604,7 @@ LTLIBOBJS
840 LIBOBJS
841 WARN_WRITE_STRINGS
842 NO_WERROR
843 +WARN_CFLAGS_FOR_BUILD
844 WARN_CFLAGS
845 GENINSRC_NEVER_FALSE
846 GENINSRC_NEVER_TRUE
847 @@ -10901,7 +10902,7 @@ else
848 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
849 lt_status=$lt_dlunknown
850 cat > conftest.$ac_ext <<_LT_EOF
851 -#line 10904 "configure"
852 +#line 10905 "configure"
853 #include "confdefs.h"
854
855 #if HAVE_DLFCN_H
856 @@ -11007,7 +11008,7 @@ else
857 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
858 lt_status=$lt_dlunknown
859 cat > conftest.$ac_ext <<_LT_EOF
860 -#line 11010 "configure"
861 +#line 11011 "configure"
862 #include "confdefs.h"
863
864 #if HAVE_DLFCN_H
865 @@ -12101,8 +12102,12 @@ fi
866 # Set the 'development' global.
867 . $srcdir/../bfd/development.sh
868
869 +# Set acp_cpp_for_build variable
870 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
871 +
872 # Default set of GCC warnings to enable.
873 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
874 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
875
876 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
877 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
878 @@ -12147,6 +12152,36 @@ fi
879 rm -f conftest*
880
881
882 +# Verify CC_FOR_BUILD to be compatible with waring flags
883 +
884 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
885 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
886 +/* end confdefs.h. */
887 +__GNUC__
888 +_ACEOF
889 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
890 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
891 +
892 +else
893 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
894 +fi
895 +rm -f conftest*
896 +
897 +
898 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
899 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
900 +/* end confdefs.h. */
901 +__GNUC__
902 +_ACEOF
903 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
904 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
905 +
906 +else
907 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
908 +fi
909 +rm -f conftest*
910 +
911 +
912 # Check whether --enable-werror was given.
913 if test "${enable_werror+set}" = set; then :
914 enableval=$enable_werror; case "${enableval}" in
915 @@ -12162,6 +12197,7 @@ case "${host}" in
916 *-*-mingw32*)
917 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
918 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
919 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
920 fi
921 ;;
922 *) ;;
923 @@ -12175,25 +12211,32 @@ fi
924 NO_WERROR=
925 if test "${ERROR_ON_WARNING}" = yes ; then
926 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
927 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
928 NO_WERROR="-Wno-error"
929 fi
930
931 if test "${GCC}" = yes ; then
932 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
933 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
934 fi
935
936 # Check whether --enable-build-warnings was given.
937 if test "${enable_build_warnings+set}" = set; then :
938 enableval=$enable_build_warnings; case "${enableval}" in
939 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
940 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
941 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
942 no) if test "${GCC}" = yes ; then
943 WARN_CFLAGS="-w"
944 + WARN_CFLAGS_FOR_BUILD="-w"
945 fi;;
946 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
947 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
948 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
949 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
950 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
951 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
952 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
953 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
954 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
955 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
956 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
957 esac
958 fi
959
960 @@ -12204,6 +12247,7 @@ fi
961
962
963
964 +
965
966
967
968 --- a/ld/Makefile.in
969 +++ b/ld/Makefile.in
970 @@ -354,6 +354,7 @@ TESTBFDLIB = @TESTBFDLIB@
971 USE_NLS = @USE_NLS@
972 VERSION = @VERSION@
973 WARN_CFLAGS = @WARN_CFLAGS@
974 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
975 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
976 XGETTEXT = @XGETTEXT@
977 YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
978 @@ -508,7 +509,7 @@ CXX_FOR_TARGET = ` \
979 fi`
980
981
982 -# Strip out sanitization options as they require special host libraries.
983 +# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
984 CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
985 CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
986 info_TEXINFOS = ld.texinfo
987 --- a/ld/configure
988 +++ b/ld/configure
989 @@ -646,6 +646,7 @@ LIBINTL
990 USE_NLS
991 WARN_WRITE_STRINGS
992 NO_WERROR
993 +WARN_CFLAGS_FOR_BUILD
994 WARN_CFLAGS
995 installed_linker
996 install_as_default
997 @@ -11723,7 +11724,7 @@ else
998 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
999 lt_status=$lt_dlunknown
1000 cat > conftest.$ac_ext <<_LT_EOF
1001 -#line 11726 "configure"
1002 +#line 11727 "configure"
1003 #include "confdefs.h"
1004
1005 #if HAVE_DLFCN_H
1006 @@ -11829,7 +11830,7 @@ else
1007 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1008 lt_status=$lt_dlunknown
1009 cat > conftest.$ac_ext <<_LT_EOF
1010 -#line 11832 "configure"
1011 +#line 11833 "configure"
1012 #include "confdefs.h"
1013
1014 #if HAVE_DLFCN_H
1015 @@ -15558,8 +15559,12 @@ fi
1016 # Set the 'development' global.
1017 . $srcdir/../bfd/development.sh
1018
1019 +# Set acp_cpp_for_build variable
1020 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
1021 +
1022 # Default set of GCC warnings to enable.
1023 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
1024 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
1025
1026 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
1027 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1028 @@ -15604,6 +15609,36 @@ fi
1029 rm -f conftest*
1030
1031
1032 +# Verify CC_FOR_BUILD to be compatible with waring flags
1033 +
1034 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
1035 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1036 +/* end confdefs.h. */
1037 +__GNUC__
1038 +_ACEOF
1039 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
1040 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
1041 +
1042 +else
1043 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
1044 +fi
1045 +rm -f conftest*
1046 +
1047 +
1048 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
1049 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1050 +/* end confdefs.h. */
1051 +__GNUC__
1052 +_ACEOF
1053 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
1054 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
1055 +
1056 +else
1057 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
1058 +fi
1059 +rm -f conftest*
1060 +
1061 +
1062 # Check whether --enable-werror was given.
1063 if test "${enable_werror+set}" = set; then :
1064 enableval=$enable_werror; case "${enableval}" in
1065 @@ -15619,6 +15654,7 @@ case "${host}" in
1066 *-*-mingw32*)
1067 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
1068 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
1069 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
1070 fi
1071 ;;
1072 *) ;;
1073 @@ -15632,25 +15668,32 @@ fi
1074 NO_WERROR=
1075 if test "${ERROR_ON_WARNING}" = yes ; then
1076 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
1077 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
1078 NO_WERROR="-Wno-error"
1079 fi
1080
1081 if test "${GCC}" = yes ; then
1082 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
1083 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
1084 fi
1085
1086 # Check whether --enable-build-warnings was given.
1087 if test "${enable_build_warnings+set}" = set; then :
1088 enableval=$enable_build_warnings; case "${enableval}" in
1089 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
1090 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
1091 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
1092 no) if test "${GCC}" = yes ; then
1093 WARN_CFLAGS="-w"
1094 + WARN_CFLAGS_FOR_BUILD="-w"
1095 fi;;
1096 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1097 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
1098 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
1099 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
1100 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1101 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
1102 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1103 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
1104 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
1105 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
1106 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1107 esac
1108 fi
1109
1110 @@ -15661,6 +15704,7 @@ fi
1111
1112
1113
1114 +
1115
1116
1117
1118 --- a/opcodes/Makefile.in
1119 +++ b/opcodes/Makefile.in
1120 @@ -267,6 +267,7 @@ STRIP = @STRIP@
1121 USE_NLS = @USE_NLS@
1122 VERSION = @VERSION@
1123 WARN_CFLAGS = @WARN_CFLAGS@
1124 +WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
1125 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
1126 XGETTEXT = @XGETTEXT@
1127 abs_builddir = @abs_builddir@
1128 --- a/opcodes/configure
1129 +++ b/opcodes/configure
1130 @@ -643,6 +643,7 @@ MAINTAINER_MODE_TRUE
1131 NO_WMISSING_FIELD_INITIALIZERS
1132 WARN_WRITE_STRINGS
1133 NO_WERROR
1134 +WARN_CFLAGS_FOR_BUILD
1135 WARN_CFLAGS
1136 OTOOL64
1137 OTOOL
1138 @@ -11150,7 +11151,7 @@ else
1139 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1140 lt_status=$lt_dlunknown
1141 cat > conftest.$ac_ext <<_LT_EOF
1142 -#line 11153 "configure"
1143 +#line 11154 "configure"
1144 #include "confdefs.h"
1145
1146 #if HAVE_DLFCN_H
1147 @@ -11256,7 +11257,7 @@ else
1148 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1149 lt_status=$lt_dlunknown
1150 cat > conftest.$ac_ext <<_LT_EOF
1151 -#line 11259 "configure"
1152 +#line 11260 "configure"
1153 #include "confdefs.h"
1154
1155 #if HAVE_DLFCN_H
1156 @@ -11508,8 +11509,12 @@ fi
1157 # Set the 'development' global.
1158 . $srcdir/../bfd/development.sh
1159
1160 +# Set acp_cpp_for_build variable
1161 +ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
1162 +
1163 # Default set of GCC warnings to enable.
1164 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
1165 +GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
1166
1167 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
1168 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1169 @@ -11554,6 +11559,36 @@ fi
1170 rm -f conftest*
1171
1172
1173 +# Verify CC_FOR_BUILD to be compatible with waring flags
1174 +
1175 +# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
1176 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1177 +/* end confdefs.h. */
1178 +__GNUC__
1179 +_ACEOF
1180 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
1181 + $EGREP "^[0-3]$" >/dev/null 2>&1; then :
1182 +
1183 +else
1184 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
1185 +fi
1186 +rm -f conftest*
1187 +
1188 +
1189 +# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
1190 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1191 +/* end confdefs.h. */
1192 +__GNUC__
1193 +_ACEOF
1194 +if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
1195 + $EGREP "^[0-4]$" >/dev/null 2>&1; then :
1196 +
1197 +else
1198 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
1199 +fi
1200 +rm -f conftest*
1201 +
1202 +
1203 # Check whether --enable-werror was given.
1204 if test "${enable_werror+set}" = set; then :
1205 enableval=$enable_werror; case "${enableval}" in
1206 @@ -11569,6 +11604,7 @@ case "${host}" in
1207 *-*-mingw32*)
1208 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
1209 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
1210 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
1211 fi
1212 ;;
1213 *) ;;
1214 @@ -11582,25 +11618,32 @@ fi
1215 NO_WERROR=
1216 if test "${ERROR_ON_WARNING}" = yes ; then
1217 GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
1218 + GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
1219 NO_WERROR="-Wno-error"
1220 fi
1221
1222 if test "${GCC}" = yes ; then
1223 WARN_CFLAGS="${GCC_WARN_CFLAGS}"
1224 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
1225 fi
1226
1227 # Check whether --enable-build-warnings was given.
1228 if test "${enable_build_warnings+set}" = set; then :
1229 enableval=$enable_build_warnings; case "${enableval}" in
1230 - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
1231 + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}"
1232 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
1233 no) if test "${GCC}" = yes ; then
1234 WARN_CFLAGS="-w"
1235 + WARN_CFLAGS_FOR_BUILD="-w"
1236 fi;;
1237 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1238 - WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
1239 + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
1240 + WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
1241 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1242 - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
1243 - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1244 + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
1245 + WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
1246 + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
1247 + WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1248 esac
1249 fi
1250
1251 @@ -11611,6 +11654,7 @@ fi
1252
1253
1254
1255 +
1256
1257
1258 ac_ext=c