From patchwork Mon Apr 22 15:04:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 238579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 40C452C0124 for ; Tue, 23 Apr 2013 01:16:11 +1000 (EST) Received: from localhost ([::1]:52799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIJg-0000LK-BI for incoming@patchwork.ozlabs.org; Mon, 22 Apr 2013 11:06:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIIu-0000E6-K9 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUIIs-0001VY-Fj for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:05:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIIs-0001VS-6Q for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:05:14 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3MF5D9Z017064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Apr 2013 11:05:13 -0400 Received: from localhost.localdomain (vpn1-6-224.ams2.redhat.com [10.36.6.224]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3MF4xGq020026; Mon, 22 Apr 2013 11:05:12 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2013 18:04:37 +0300 Message-Id: <1366643098-2566-8-git-send-email-alevy@redhat.com> In-Reply-To: <1366643098-2566-1-git-send-email-alevy@redhat.com> References: <1366643098-2566-1-git-send-email-alevy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r3MF5D9Z017064 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: mlureau@redhat.com Subject: [Qemu-devel] [PATCH v3 07/28] build-sys: must link with -fstack-protector X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 ed49f91..dcc4767 100755 --- a/configure +++ b/configure @@ -1238,7 +1238,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 @@ -1257,6 +1257,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 @@ -4068,6 +4073,7 @@ else echo "AUTOCONF_HOST := " >> $config_host_mak fi echo "LDFLAGS=$LDFLAGS" >> $config_host_mak +echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak echo "EXESUF=$EXESUF" >> $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