From patchwork Tue Apr 8 20:37:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 28039 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 81F8720553 for ; Tue, 8 Apr 2014 20:38:34 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id r5sf4040027qcx.1 for ; Tue, 08 Apr 2014 13:38:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :from:date:message-id:to:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type; bh=ma0aBtczsagDrSqdY1ZWpf3K5SmCXLAF8Uj2CqOjot0=; b=cuwsXV/5HmBA7/V7wlQfYybAkmmy74b7D9cIJ18NRsnQp15q3iDsewjpaHLG08c3TJ WIH/8lpzYbNwK0Mb0/XqhzgaM9cVlCsvVEwAOZX3i0lC/llKbkjl/dgYKbLywnm7hxH+ ACKC6Bwm8iyC7W4UzMnvYsbHsvowxe/Y4FLN0JLtPFgRr5zn/huqPQZz29kJ6d0gBcf9 CaKbzkk5f+Tu5pGpKK3YixIedOCG3tZDeh2fucToZi+SCF3N/2MAAf6sjAhluvM7lrU2 3pOpXEOeAh4JESwqGMUZhsHNC1NK5kW4pyFOZlocbpSRFzjexYDBu2jNrx4Y9ETFaYmL BoTg== X-Gm-Message-State: ALoCoQmGNjBeUwKsjdLeGzVZhUbGsi8/ID7gmab2cQQcYr174p3nG0fq0YU9tjYoRtGSWFdKPX3V X-Received: by 10.52.61.197 with SMTP id s5mr2466209vdr.8.1396989514214; Tue, 08 Apr 2014 13:38:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.28.137 with SMTP id 9ls336781qgz.14.gmail; Tue, 08 Apr 2014 13:38:34 -0700 (PDT) X-Received: by 10.58.13.104 with SMTP id g8mr4902511vec.16.1396989514039; Tue, 08 Apr 2014 13:38:34 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id sr19si611931vcb.179.2014.04.08.13.38.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 13:38:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ib6so1305134vcb.13 for ; Tue, 08 Apr 2014 13:38:34 -0700 (PDT) X-Received: by 10.52.99.168 with SMTP id er8mr3925745vdb.26.1396989513959; Tue, 08 Apr 2014 13:38:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp276244vcv; Tue, 8 Apr 2014 13:38:33 -0700 (PDT) X-Received: by 10.229.116.193 with SMTP id n1mr7641645qcq.10.1396989513056; Tue, 08 Apr 2014 13:38:33 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g2si1439516qab.268.2014.04.08.13.38.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Apr 2014 13:38:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:42736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXcmu-0003L0-L9 for patch@linaro.org; Tue, 08 Apr 2014 16:38:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXcmM-00033R-Ib for qemu-devel@nongnu.org; Tue, 08 Apr 2014 16:38:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXcmC-00059q-TP for qemu-devel@nongnu.org; Tue, 08 Apr 2014 16:37:58 -0400 Received: from mail-bk0-f49.google.com ([209.85.214.49]:54900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXcmC-00059h-Mt for qemu-devel@nongnu.org; Tue, 08 Apr 2014 16:37:48 -0400 Received: by mail-bk0-f49.google.com with SMTP id my13so1231832bkb.8 for ; Tue, 08 Apr 2014 13:37:47 -0700 (PDT) X-Received: by 10.112.52.104 with SMTP id s8mr4098067lbo.7.1396989467730; Tue, 08 Apr 2014 13:37:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.180.233 with HTTP; Tue, 8 Apr 2014 13:37:27 -0700 (PDT) In-Reply-To: <1396023542-19667-1-git-send-email-pbonzini@redhat.com> References: <1396023542-19667-1-git-send-email-pbonzini@redhat.com> From: Peter Maydell Date: Tue, 8 Apr 2014 21:37:27 +0100 Message-ID: To: Paolo Bonzini X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.49 Cc: Laurent Desnogues , Steven Noonan , Steven Noonan , QEMU Developers , Anthony Liguori Subject: Re: [Qemu-devel] [PATCH for-2.0] configure: add option to disable -fstack-protector flags 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 28 March 2014 16:19, Paolo Bonzini wrote: > This patch introduces a configure option to disable the stack protector > entirely, and conditional stack protector flag selection (in order, > based on availability): -fstack-protector-strong, -fstack-protector-all, > no stack protector. I've just noticed that this test doesn't correctly handle MacOSX clang. For some reason that has this behaviour: manooth$ clang -o /tmp/zz9 -Werror -fstack-protector /tmp/zz9.c # OK, plain -fstack-protector works manooth$ clang -o /tmp/zz9 -Werror -fstack-protector-strong /tmp/zz9.c clang: error: argument unused during compilation: '-fstack-protector-strong' # The strong variant isn't implemented manooth$ clang -o /tmp/zz9 -Werror -fstack-protector-strong /tmp/zz9.c -framework CoreFoundation # ...but for some reason adding the -framework CoreFoundation argument # suppresses the error! This is bad because we have that framework argument as part of our linker flags. Effectively this means that clang won't warn about the argument at link time but will warn for every .c->.o compile (as well as ending up with no stack protection). Changing the test from doing a compile-and-link to just compiling a single object seems to fix this: manooth$ git diff However perhaps the correct fix is to make MacOSX put the -framework options in CFLAGS, not LDFLAGS -- they seem (from what I can gather from google, which is not much) to be a sort of combination of include files and libraries so should probably be consistently specified everywhere. thanks -- PMM 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