From patchwork Wed Dec 18 03:19:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 181966 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp88285ile; Tue, 17 Dec 2019 19:22:17 -0800 (PST) X-Google-Smtp-Source: APXvYqz94nlz9F4fKIJ4HJwlEddP3j+ziZVJ0A8e2qo0XC7zSygmLqx0NSZaRyTfRpmxchJH/seY X-Received: by 2002:a05:6830:1e5c:: with SMTP id e28mr107906otj.293.1576639337603; Tue, 17 Dec 2019 19:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576639337; cv=none; d=google.com; s=arc-20160816; b=UfWubJcGYhWyvShDx8az7K+GXpTnEmMbqABEDPFqprxGHLSAWMqwssIgcHiRFxU6BA 1OiUpzbbTZhCsTXenwaZGf7LZZNmrQDTB+o42yrhMijn/9BfjHlHwBfdrfu8fBBjImWV 8ykqWhODW6OESTTu/mf0sg5UQzqPkOSyC5bF/dcNbm+FUk8xWCs4fRvLndHUIjFvlXTM p8g/BwnL/iC4eawPmdhS8Vp/WEegPoj+3egRX6EmtEYLCwPRVkBV4v0DZPA0qpkzWCjs IxE+ZQAy/LcqlGOxGUSbIougsgYd0O09FHDzWSXrkrwNN9+pd7xnA6Eja4Gp4UrHVvT1 smSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jQ/iIszATFHSOTQDeJa8KJZXVRGX9Wk3W4o78mWyy8c=; b=YF7J6UGDIT2Fx1iEwz3igNfPZ4CCcBFMpRhydAhZAIjgfJrt5NemKgblXyuokbfw67 we+k/Zc/HmBTq1Ra/JSBIK/XgWv0yYP3+Fe0xHpJbqGGVCzzqlw4WXx6dOlltqct0G6j hGmF4c0wh142+urGBBNWa5fRPdPuY12vFMTMg/RVw1hG3dLHctpiVkcpmHogLKW/cIpR ZWbsIUpYl1myMytEYoDDvtK/NYgY5dVW0Ak9CBZDNsdgqz6F4P2AY3GuLamb78wftFb+ UxshvzB2Oer7MjK+DCvVKM20Kah2uvl255TYiPgODwI8WuqLO+LkrYK7p6i/zQXPUOE8 ZQ3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=C7Td26JB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z23si588560otk.166.2019.12.17.19.22.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Dec 2019 19:22:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=C7Td26JB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihPui-0007eM-ML for patch@linaro.org; Tue, 17 Dec 2019 22:22:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44406) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihPs8-0004CY-Ln for qemu-devel@nongnu.org; Tue, 17 Dec 2019 22:19:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihPs7-0002nM-Jx for qemu-devel@nongnu.org; Tue, 17 Dec 2019 22:19:36 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:39428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihPs7-0002mJ-E4 for qemu-devel@nongnu.org; Tue, 17 Dec 2019 22:19:35 -0500 Received: by mail-pg1-x542.google.com with SMTP id b137so447265pga.6 for ; Tue, 17 Dec 2019 19:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jQ/iIszATFHSOTQDeJa8KJZXVRGX9Wk3W4o78mWyy8c=; b=C7Td26JBg2DeSPn3In/NgHzc9ZBHnWvdYisiPXb61qYCoWnR3bhiNx0VVtTSRPQNY4 WtpRSZgZhAAHQIRlOg70Q+VKAdnh2r98qj5gaKzL82BVH5gXKgl1W0qf03UqiDmIuJex txVOxty6zkom0Psg/1aRYbLD0cQKB+wyN3syTtH1H6JGY8CTBrkvF1a4oTZcwtpPxocX wm7/+eWogKW33UYV8qICU1KriRil69VtwRTLlibRxPxjl6MeWFJVf+6yiWII22DPe5Q6 a4jW8/ZhXHIZzXiQdkaeBC+CQQzX0bIO55EEYHQKsHsJeenJhwVZen955cX3S8bIfPNt 6qMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jQ/iIszATFHSOTQDeJa8KJZXVRGX9Wk3W4o78mWyy8c=; b=YSPVPgoC4N/J9Gy+wKay02gthfX9d7SbPLxo2ICUrYfYdYf+NgcT8sVUmEC9p1q2H5 1FvlHQxpi/GVA5Sst7BAQ4lzjCys0N7qLHduZmAnHSbU9yswsYp31wzBTShQzaz6iPkM FbOovmhVzKmYqT41mBa9e/dbxq2dBdRHVRy/KcVIMPEW04pgCHAbfWgql/+tMzfUgja0 K8hohoi3U2C9tG9nTsw9yI/iJQwE5M8gFFB1Y59/NhjCKQdG1GLhaWmjkrnsvQJ97zDW rp+9RaF53GAWCv0QeLg962gEex0X4K9wrJksGymI+agjCNWCZ3raH5g4x5MjG5TAXxyn JbsQ== X-Gm-Message-State: APjAAAU/jIuMtPNOa8Sx0+TnXFcxTBlByzOfKpWCu84bZOgHZ2oZ984i OEH1aXDZHGDfpT7dxmHOtdd6ybIWuvA= X-Received: by 2002:a65:56c9:: with SMTP id w9mr323141pgs.296.1576639174204; Tue, 17 Dec 2019 19:19:34 -0800 (PST) Received: from localhost.localdomain ([2605:e000:c74f:dc00:6838:d2b2:17e2:8445]) by smtp.gmail.com with ESMTPSA id k27sm404870pfp.66.2019.12.17.19.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 19:19:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/7] configure: Support -static-pie if requested Date: Tue, 17 Dec 2019 17:19:20 -1000 Message-Id: <20191218031920.6414-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191218031920.6414-1-richard.henderson@linaro.org> References: <20191218031920.6414-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, i@maskray.me, berrange@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Recent toolchains support static and pie at the same time. As with normal dynamic builds, allow --static to default to PIE if supported by the toolchain. Allow --enable/--disable-pie to override the default. Signed-off-by: Richard Henderson --- configure | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) -- 2.20.1 Reviewed-by: Thomas Huth diff --git a/configure b/configure index 1645a58b3a..c03491018a 100755 --- a/configure +++ b/configure @@ -1023,7 +1023,6 @@ for opt do ;; --static) static="yes" - LDFLAGS="-static $LDFLAGS" QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" ;; --mandir=*) mandir="$optarg" @@ -1994,11 +1993,6 @@ if test "$static" = "yes" ; then if test "$modules" = "yes" ; then error_exit "static and modules are mutually incompatible" fi - if test "$pie" = "yes" ; then - error_exit "static and pie are mutually incompatible" - else - pie="no" - fi fi # Unconditional check for compiler __thread support @@ -2032,6 +2026,17 @@ fi if test "$pie" = "no"; then QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS" +elif test "$static" = "yes"; then + if compile_prog "-fPIE -DPIE" "-static-pie"; then + QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" + LDFLAGS="-static-pie $LDFLAGS" + pie="yes" + elif test "$pie" = "yes"; then + error_exit "-static-pie not available due to missing toolchain support" + else + LDFLAGS="-static $LDFLAGS" + pie="no" + fi elif compile_prog "-fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" LDFLAGS="-pie $LDFLAGS"