From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ5cK-0002N1-Tj for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:19:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJ5cG-0000dg-7F for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:19:00 -0400 Received: from mail-vb0-x231.google.com ([2607:f8b0:400c:c02::231]:48543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ5cG-0000dS-34 for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:18:56 -0400 Received: by mail-vb0-f49.google.com with SMTP id s24so2683205vbi.22 for ; Fri, 22 Mar 2013 10:18:55 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <514C927B.8060004@redhat.com> Date: Fri, 22 Mar 2013 18:18:51 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1363612272-13713-1-git-send-email-alevy@redhat.com> <1363612272-13713-8-git-send-email-alevy@redhat.com> In-Reply-To: <1363612272-13713-8-git-send-email-alevy@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 07/26] build-sys: must link with -fstack-protector List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alon Levy Cc: mlureau@redhat.com, qemu-devel@nongnu.org Il 18/03/2013 14:10, Alon Levy ha scritto: > From: Marc-André Lureau > > It is needed to give that flag to the linker as well, but latest > libtool 2.4.2 still swallows that argument, so let's pass it with > libtool -Wc argument. > > qemu-1.4.0/stubs/arch-query-cpu-def.c:6: undefined reference to `__stack_chk_guard' > > Signed-off-by: Marc-André Lureau > --- > configure | 8 +++++++- > rules.mak | 1 + > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 46a7594..d76866a 100755 > --- a/configure > +++ b/configure > @@ -1209,7 +1209,7 @@ fi > gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" > gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" > gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" > -gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" > +gcc_flags="-Wendif-labels $gcc_flags" > gcc_flags="-Wno-initializer-overrides $gcc_flags" > # Note that we do not add -Werror to gcc_flags here, because that would > # enable it for all configure tests. If a configure test failed due > @@ -1228,6 +1228,11 @@ for flag in $gcc_flags; do > fi > done > > +if compile_prog "-Werror -fstack-protector-all" "" ; then > + QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all" > + LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all" > +fi > + > # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and > # large functions that use global variables. The bug is in all releases of > # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in > @@ -3890,6 +3895,7 @@ else > echo "AUTOCONF_HOST := " >> $config_host_mak > fi > echo "LDFLAGS=$LDFLAGS" >> $config_host_mak > +echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak > echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak > echo "ARLIBS_END=$arlibs_end" >> $config_host_mak > echo "LIBS+=$LIBS" >> $config_host_mak > diff --git a/rules.mak b/rules.mak > index edc2552..36aba2d 100644 > --- a/rules.mak > +++ b/rules.mak > @@ -36,6 +36,7 @@ LINK = $(call quiet-command,\ > $(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \ > )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ > $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \ > + $(if $(filter %.lo %.la,$^),$(LIBTOOLFLAGS)) \ > $(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", " LINK ")"$(TARGET_DIR)$@") > endif > > Reviewed-by: Paolo Bonzini