On 04/09/2014 09:04 PM, Peter Maydell wrote: > MacOSX clang silently swallows unrecognized -f options when doing a link > with '-framework' also on the command line, so to detect support for > the various -fstack-protector options we must do a plain .c to .o compile, > not a complete compile-and-link. > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > --- > This should be a pretty safe change and it prevents clang/MacOSX > builds from spewing a warning on every C file compilation, so I'd > like to get it into 2.0. > > configure | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure b/configure > index eb0e7bb..c85475f 100755 > --- a/configure > +++ b/configure > @@ -1448,7 +1448,7 @@ done > if test "$stack_protector" != "no" ; then > gcc_flags="-fstack-protector-strong -fstack-protector-all" > for flag in $gcc_flags; do > - if compile_prog "-Werror $flag" "" ; then > + if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC ; then > QEMU_CFLAGS="$QEMU_CFLAGS $flag" > LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag" > break >
My cross environment fails after this patch on "-fstack-protector-all". Without the patch, gcc for test program gets additional "-m64 -g -L/home/alexey/crosslib/qemu-build-lib-fc19/usr/lib64" (the last one is mine, passed via --extra-ldflags=), fails with an error (below). With the patch, the configure script thinks everything is fine and fails on "ERROR: zlib check failed". Why is this happening? Thanks. powerpc64-linux-gcc -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common --sysroot=/home/alexey/crosslib/qemu-build-lib-fc19/ -isystem /home/alexey/crosslib/qemu-build-lib-fc19/usr/include -D__EXCEPTIONS -D__LONG_DOUBLE_128__ -D__NO_INLINE__ -Wno-redundant-decls -Wno-missing-prototypes -Wmissing-include-dirs -Wno-system-headers -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -Werror -fstack-protector-strong -o /tmp/qemu-conf-24556-2284-15038.exe /tmp/qemu-conf-31026-2284-18135.c -m64 -g -L/home/alexey/crosslib/qemu-build-lib-fc19/usr/lib64 powerpc64-linux-gcc: error: unrecognized command line option '-fstack-protector-strong' powerpc64-linux-gcc -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common --sysroot=/home/alexey/crosslib/qemu-build-lib-fc19/ -isystem /home/alexey/crosslib/qemu-build-lib-fc19/usr/include -D__EXCEPTIONS -D__LONG_DOUBLE_128__ -D__NO_INLINE__ -Wno-redundant-decls -Wno-missing-prototypes -Wmissing-include-dirs -Wno-system-headers -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -Werror -fstack-protector-all -o /tmp/qemu-conf-24556-2284-15038.exe /tmp/qemu-conf-31026-2284-18135.c -m64 -g -L/home/alexey/crosslib/qemu-build-lib-fc19/usr/lib64 /home/system/opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/4.8.0/../../../../powerpc64-linux/bin/ld: cannot find -lssp_nonshared /home/system/opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/4.8.0/../../../../powerpc64-linux/bin/ld: cannot find -lssp collect2: error: ld returned 1 exit status -- Alexey