From patchwork Wed Dec 18 22:34:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182038 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1285046ile; Wed, 18 Dec 2019 14:39:59 -0800 (PST) X-Google-Smtp-Source: APXvYqz7tjRQXYOjuNBcyZJ7o0hNijNjSzh5JMZXA+W7j++cqG2tH+pmXxtpThNuz8/NnXcdSOB8 X-Received: by 2002:a05:6830:594:: with SMTP id c20mr5306344oth.166.1576708799845; Wed, 18 Dec 2019 14:39:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708799; cv=none; d=google.com; s=arc-20160816; b=foxLqFl9VTSx5+2qga5yIaNhDDQpyPWx7B3gfmajrHFhKe6VUZeHXBCAv7YyKP7Z/e Nw1rleLeZHgy9PPKvlq48GYcf2XtfeE0GpT3ikbsE2h5QlIRKtZHMrAxNqmipd83oh23 1Dlv1YiWngH37wzg3js320DEndHhe7Kxse/kx31yT0rP5z3OyElYu/6rYA2RRkQp6NMl 5r9qfPwPFDxjGwLCiTdVc8mhoc9XYNDse+vGjh1F1O9lHYRwcU4a1LAYhdEyK0WHf4AP +F9yUHgLi+YWvoSW+tP4qGAD/garej9q+WKApvzyqzwMbyYbadRGWRSgvin2O+84jYro 1IDA== 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=Nnco/E+zVxOFsFP+larGarLDAJ4rkyQI0DmqW8gT1oM=; b=RYmTjPMQ1GcnqM5WGY+Io42A8IuvJxxvGGN+TTf72JZ8SWtkyZ2ZMWW52It7hfpK9X WZJ2qWneSF6MuYXBX6zg4Bx5V/nbq/Erj0DSLXrMt2VRFIrrHheYA8dy2t14xT4qwyIV w7gFH2ePQ0v48RPbym3nCPn08ChWlsarfS9ZmxcWLBaIInJBDfWyN9Z/FE/NDrptjkzR Y2wGsued/7UFKn83LklyBuZs9UzF/74JjUegMdVc3c3CXWzas7FTd9IMuh8Ut/VK52E1 JQ8Oy4LvxnjnBorUwQGEHONxyb6qDOH3f9ummB+wiJFn4ea1PNPJXiQ2v1unbl2hE6BT 5EOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fRtQOXtL; 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 7si3039775otk.79.2019.12.18.14.39.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:39:59 -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=fRtQOXtL; 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]:33500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhz5-0007td-7i for patch@linaro.org; Wed, 18 Dec 2019 17:39:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54494) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhuE-0001bk-I0 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhuD-0003zN-4j for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:58 -0500 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:33595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhuC-0003ym-Vo for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:57 -0500 Received: by mail-pg1-x541.google.com with SMTP id 6so2041056pgk.0 for ; Wed, 18 Dec 2019 14:34:56 -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=Nnco/E+zVxOFsFP+larGarLDAJ4rkyQI0DmqW8gT1oM=; b=fRtQOXtLhs0VgWrs+S4Iee2qIsHgt5aAmTMs8RsT+f5CKpf/HpmMgjpDej9XGvcTJB 3kAMDVjWi6hlqxDp6NKyd2DiI8edfiYi9xYpSnhEQLIwvNepuIixkzhgIQfp2cd8VsaS mkslfX6kP56fpCxnyzNW/udiAwAmhla0Mgt+cAQ5fNgdTMastz7hfBP3NHqoxMN045Zk +P6xYuvDyWoImrSWwGRSBjxXzYuMze993meqy7JGJJ1ecyDm5rsPccv/ZTn7Z6EJYAJ2 SMO/JzLGm+cLSfpvBci3kLao0DOug6R1BB9vzpY7PtrQR9fXbb2E/CE8cAYRVLtf558w THAw== 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=Nnco/E+zVxOFsFP+larGarLDAJ4rkyQI0DmqW8gT1oM=; b=Z5Mr6j14MMD+iXxPMYaJyp86xcIUgS1PzXGA1vqfdy7aC5Zf9U63xHfPgpWGoePYPQ LX/BBwGnNxqUfFEz2rtuC3+hEcHy+9/U4eiah29+48RHkXsmYYWD6lxg1CiGxlPA+6Uo cmWuO9pMp+xt9VmlfDQJcTSy+gIGxZtxN23Q3xDYE5EgpvDGBivLtOeijxo9zvoxHx9b KXYJB/keo5RU6sodPTX2LUb/mC6JwmK2I/PNwldrlKPT9EQ5GQzdhESAchxYtAQDElql QHgboRb8hoGX+Nn9w5LanzT6o/SSXwUu5AEPaRGbEemXA1dUypc4NpBeNUhG9ry+6Ug6 CHlQ== X-Gm-Message-State: APjAAAXxuNGvF8/jPV9nFRDR8/McgXrR2wq4Ht9Klq8hWTeu0pdTev+1 yWvcBPr+LVnDXLS+Sn+f+IZ83qP4Rhc= X-Received: by 2002:a63:214f:: with SMTP id s15mr5894774pgm.238.1576708495723; Wed, 18 Dec 2019 14:34:55 -0800 (PST) Received: from localhost.localdomain ([2605:e000:c74f:dc00:6838:d2b2:17e2:8445]) by smtp.gmail.com with ESMTPSA id j1sm4627779pff.107.2019.12.18.14.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 7/7] configure: Support -static-pie if requested Date: Wed, 18 Dec 2019 12:34:41 -1000 Message-Id: <20191218223441.23852-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191218223441.23852-1-richard.henderson@linaro.org> References: <20191218223441.23852-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::541 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 --- v2: Fix --disable-pie --static --- configure | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/configure b/configure index f6ff079fab..55586c5498 100755 --- a/configure +++ b/configure @@ -1024,7 +1024,6 @@ for opt do ;; --static) static="yes" - LDFLAGS="-static $LDFLAGS" QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" ;; --mandir=*) mandir="$optarg" @@ -2000,11 +1999,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 @@ -2035,7 +2029,18 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then LDFLAGS_NOPIE="-no-pie" fi -if test "$pie" = "no"; then +if test "$static" = "yes"; then + if test "$pie" != "no" && 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 test "$pie" = "no"; then QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS" elif compile_prog "-fPIE -DPIE" "-pie"; then