From patchwork Wed Dec 18 22:34:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182035 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1282526ile; Wed, 18 Dec 2019 14:37:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxcli2jb6bpdoTroGGfOJrmwrTGTsOOdgbaPajjS3f4IL+F28njEgJbeKK9HXcTyPRlkOCE X-Received: by 2002:a05:620a:143b:: with SMTP id k27mr5054084qkj.262.1576708627472; Wed, 18 Dec 2019 14:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708627; cv=none; d=google.com; s=arc-20160816; b=m5pPAgL750wQQsEMIVfTzakN/C9OrzegqwBlojSY7GP+pAjnJ7MslKhNQKzNkw1l3k Naabkm4gdyCpxa4za0l42E5WQmLtOVBeEI1ZwVO/qOo69ciQET9UAH5HtalaCxYzF3rA tzxJR1VkWn2JlJ+pHkLg9I9FIyYz7yj8WwUIcmvJUASPwMajVhVlLfyL9Bj3PShscisu RWpVEjHi1CjQe2l5qgnnFBDRH+kCZnVNzos775zzAA+teWDpyrCVbSc9nUOMZIBfII6q 5KmTkNop0Qj1RhKpV3457nrCqFmRWSZSB7olB941KkIYgOAf13dYwWL8SyYM/L3jVi0i FCuA== 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=3CCNiOkBdotcPLlflc1t8sogIYTztDmOMbypR3M+57k=; b=Rsl70InUT+Y6f+z4YIbrEdk7Q2/6bBAk9U/LGHP+8E0ocZidxOHWek66a8kEy/aD5P eHMsNU/x7jkbioyxlNOLrQ0sOggMpf4ycnP1mCiYpr8lBDaIvdHGoe4ENhb74CGK+MTs 7FxZw893CJV6u9/HL0lvM+7CM0Q5Xn08Vp85juuGvhtrxMR81zK6fuDeu2kILxf+xXhQ hTy9/crWAyvID+WrfcQJPCLBAnNhth6jx51mZkSSZDkoYEjUP7k3FH/p31cADN8+cI8/ znQmsRCHfDcmSfj0MkBLna6hoChT9RTfFRa+4g9HfqeNINsopDuam3yON9AAmzbGARvD At4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hauNGhrJ; 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 j2si2554039qkl.71.2019.12.18.14.37.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:37:07 -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=hauNGhrJ; 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]:33454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhwI-0004C9-VH for patch@linaro.org; Wed, 18 Dec 2019 17:37:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhu7-0001TG-3T for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhu5-0003uP-9m for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:51 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:41704) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhu3-0003tP-Kw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:49 -0500 Received: by mail-pg1-x543.google.com with SMTP id x8so2020726pgk.8 for ; Wed, 18 Dec 2019 14:34:47 -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=3CCNiOkBdotcPLlflc1t8sogIYTztDmOMbypR3M+57k=; b=hauNGhrJnf8EflRroccGva02uhxQK4nlyYK3/WZhLfdvOlUcO2wcF8qCNd3nDP/lJu eOVZk7maOwFKw8BRBLCfI/YQ8GmPVZI952/1Uvc8vGFMkVJb19tpo5nXHE5Q/kilYmsI X3U+hrOUlnCyxPLFoua5Bu54JJxF1z22+58WEruv9itdVSrlQ3otlf/t4mgzG13AyRHU 6Sa2TVf5LV3NhyLcjJt9pqt7lkseyPmXmZyxSlt6lnaQa8ZU9azwnF8ekEtJemK7xr6S vNXf0uR4Esl4T/fTfHWYi8caFdf5x47Emh0CDMr0O5PRPeff9VPAlsajGfeTIvIvx6kz mNbQ== 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=3CCNiOkBdotcPLlflc1t8sogIYTztDmOMbypR3M+57k=; b=X2jpK1H1JvmtalQeYESPvoYZ5C14CpOt0yE2hV1iUH7GwC65p8O8l7n04iwqZdjhqe dxrDDt1P5nFvWbAVbYYE6JPR++0woBN4KuScNwwU8UoNcpINpWM3jOuhjDbLxIPtxKmo vJ9lz0TGGowzcnj1KiFhvHkW+AQNRFE9tz6t5vRqjKQPPIMUr0sxKs9DheV2ZnvkyG1k E2Qhq4W39y/bMbifvEVxlSlbYU2k0USEb+tGMxxq6s6Cv1hDSVyyX2C28OiblTTMV1+o xCpu1anzb+NSa/Hi7dSPxuKXQavruZ0IHmtGmXVroBaePbCAV5tYXSSRzDV2+PvTEC6a p6+w== X-Gm-Message-State: APjAAAUfOExxcmsHD4cH9SrnRGJlNYUYOoRoEX19WaMgfAzu9Ls9gEvs cS7DH4pYthWIuk2aUk9eBSCrCQm8rgs= X-Received: by 2002:a65:4d0b:: with SMTP id i11mr5891442pgt.340.1576708486236; Wed, 18 Dec 2019 14:34:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/7] configure: Drop adjustment of textseg Date: Wed, 18 Dec 2019 12:34:35 -1000 Message-Id: <20191218223441.23852-2-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::543 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, Thomas Huth , i@maskray.me, berrange@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This adjustment was random and unnecessary. The user mode startup code in probe_guest_base() will choose a value for guest_base that allows the host qemu binary to not conflict with the guest binary. With modern distributions, this isn't even used, as the default is PIE, which does the same job in a more portable way. Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- v2: Remove mention of config-host.ld from make distclean --- Makefile | 2 +- configure | 47 ----------------------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) -- 2.20.1 diff --git a/Makefile b/Makefile index 1361def144..adf83f75a1 100644 --- a/Makefile +++ b/Makefile @@ -735,7 +735,7 @@ rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(M endef distclean: clean - rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi + rm -f config-host.mak config-host.h* $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi rm -f tests/tcg/config-*.mak rm -f config-all-devices.mak config-all-disas.mak config.status rm -f $(SUBDIR_DEVICES_MAK) diff --git a/configure b/configure index e0c66ee9b6..30e3875c6b 100755 --- a/configure +++ b/configure @@ -6298,49 +6298,6 @@ if test "$cpu" = "s390x" ; then fi fi -# Probe for the need for relocating the user-only binary. -if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then - textseg_addr= - case "$cpu" in - arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) - # ??? Rationale for choosing this address - textseg_addr=0x60000000 - ;; - mips) - # A 256M aligned address, high in the address space, with enough - # room for the code_gen_buffer above it before the stack. - textseg_addr=0x60000000 - ;; - esac - if [ -n "$textseg_addr" ]; then - cat > $TMPC </dev/null 2>&1; then - error_exit \ - "We need to link the QEMU user mode binaries at a" \ - "specific text address. Unfortunately your linker" \ - "doesn't support either the -Ttext-segment option or" \ - "printing the default linker script with --verbose." \ - "If you don't want the user mode binaries, pass the" \ - "--disable-user option to configure." - fi - - $ld --verbose | sed \ - -e '1,/==================================================/d' \ - -e '/==================================================/,$d' \ - -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ - -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld - textseg_ldflags="-Wl,-T../config-host.ld" - fi - fi -fi - # Check that the C++ compiler exists and works with the C compiler. # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. if has $cxx; then @@ -7903,10 +7860,6 @@ if test "$gprof" = "yes" ; then fi fi -if test "$target_linux_user" = "yes" || test "$target_bsd_user" = "yes" ; then - ldflags="$ldflags $textseg_ldflags" -fi - # Newer kernels on s390 check for an S390_PGSTE program header and # enable the pgste page table extensions in that case. This makes # the vm.allocate_pgste sysctl unnecessary. We enable this program From patchwork Wed Dec 18 22:34:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182031 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1280799ile; Wed, 18 Dec 2019 14:35:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwBnZ/DIMoxQWMfw8+CETLua2qGxPcDPgjjWGzIsn1EgAmqPvEsiMwRRa0XPszaSasWK+HL X-Received: by 2002:a9d:461b:: with SMTP id y27mr5596632ote.280.1576708510638; Wed, 18 Dec 2019 14:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708510; cv=none; d=google.com; s=arc-20160816; b=Gqkb7wS9qw0VbNkdCxQk9dTeeYY39RFH9f4+giLLii2uDlcmo4NSkC7laOVARnceQV 6I4+DSeY5K5VGnMZWld6kWuE3RWdjZXMI8jU7Gz9puKhCPSb8yvn3RPo9Je7yzcZ5vdF AEIrpBtrrabgeLateWALmoGRxCKaG/Bw2z4kLhccngfgAu9qMbhl0vRpkK32MNJ0bK1P zekp+mo4FnrVuhLEHYjDoXHs490okD6KTncyl2sgXJo3xJehh3Pg9I5YISnFRGZgC1yI EgyysNuxfklhI52uZkEPWQvTcccSnBurOx2T0PzWaYkwx8L8oMkCBdVJaYPBtMYHZIy7 iU8w== 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=M89NR5346hcsRB2SUkQwEfQ5idMR/OARU10zt8sGydk=; b=GIDS/1BCj05icegTJ0WlVAessStEeIwoO4AQCQTEA3WuN03CrG9XPR4mc5j7zVd5kv ifiXjRJp5R2BFn6C2TV8fZn4nuBhhIiwS6VnWRDQojs3J2fnpg8s4h3wRq26b46Opd/1 83G6JtHNVfflzMc61G/tPqkaWZHsfPAX0SBXwT+q5nD7jCjALoF2bBlXxFrGDvYsLYPS o6Q+rg7n8kTBpVcPxl57v9cUVKWccMQ8wD1yFr2JkK0ojtq6eYZJrQwPSj6HaxYRequL 5UuvhLbIBILoZmV+r72LRbLPTGJJnY7YZ6C/eyJ/NYmNX2n4s2Fw4zdgacLXqyKfwmwW q96g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x3aoTvBd; 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 x26si2359994oto.1.2019.12.18.14.35.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:35:10 -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=x3aoTvBd; 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]:33382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhuP-0001UO-Oe for patch@linaro.org; Wed, 18 Dec 2019 17:35:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54291) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhu7-0001TH-3c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhu5-0003ub-G1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:51 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:37919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhu5-0003ty-A8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:49 -0500 Received: by mail-pg1-x543.google.com with SMTP id a33so2030337pgm.5 for ; Wed, 18 Dec 2019 14:34:49 -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=M89NR5346hcsRB2SUkQwEfQ5idMR/OARU10zt8sGydk=; b=x3aoTvBdaO578ZgCkCRuB0yRK+lJgM0k+ebUU7JwVoU4ixYOvNbAWMgor1/uLQAY0y KCTJ0bFqjEiUyvgGigEGFc2YQcBFNCBJoLKR4Z9sk23zCtrUS2FWwx06YGflycnJiMHp ZcdtxB/iXP+mHiA9mJR9tF0FpLjLgAbPvpYXX4yOTAK+C7no+yBIBCenwYbVr5ZK2Kwc qcqsSVIVG8FQX19MJSJvyTUwuQAuo8rQznCoyHVUTmuwMNcO+oQRcEyFyUuqJRWxvcRO Dh7NgorLwbJYrZyTEwYuMcrDbCKUfTW4wPtZqg+QzpGoxVTesitF4yk3vYDpwNRdSGH0 DkTw== 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=M89NR5346hcsRB2SUkQwEfQ5idMR/OARU10zt8sGydk=; b=kbRl3pJrHIKkCfKxLpeNVymRTEFWuONTdwcuVs+kqPz2FP5xqK4BBrHrVAb9kKj2Pz mx9bzx5tdJlDUP2WSyVknZOmeY71ctkPR1shFOnU7FycNN6Ou/EzzNimwpJi4dUxET9P BdpCQgiepy3QZAFQVYP4smrbGJj8bt0jLKPVeiaUGqIZZfXhf2acpqHf46RA10OTo9AW OOH26oaDUZZYYMVt32LKoGeKRh0G6PVyzJ2k7C9/t0o9t+1dgHA3XzDKi73XEnTHOnsL To4QE9uJuzV5SELSCxY4tG/ItQFB04wFwMuZMvzIAS6us3IhWZBhtj5Edyaswj4oG2LH hZhQ== X-Gm-Message-State: APjAAAV15zbH6O/afwIk+PM9Zcwvkbx7A7/jHpLvGLxk/081vlI51QN1 ba40ICJb/IFt+09rFy/abnvFdQ0+CSY= X-Received: by 2002:a63:d047:: with SMTP id s7mr5495335pgi.81.1576708487922; Wed, 18 Dec 2019 14:34:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 2/7] tcg: Remove softmmu code_gen_buffer fixed address Date: Wed, 18 Dec 2019 12:34:36 -1000 Message-Id: <20191218223441.23852-3-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::543 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, Thomas Huth , i@maskray.me, berrange@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The commentary talks about "in concert with the addresses assigned in the relevant linker script", except there is no linker script for softmmu, nor has there been for some time. (Do not confuse the user-only linker script editing that was removed in the previous patch, because user-only does not use this code_gen_buffer allocation method.) Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9f48da9472..88468a1c08 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1032,47 +1032,20 @@ static inline void *alloc_code_gen_buffer(void) { int prot = PROT_WRITE | PROT_READ | PROT_EXEC; int flags = MAP_PRIVATE | MAP_ANONYMOUS; - uintptr_t start = 0; size_t size = tcg_ctx->code_gen_buffer_size; void *buf; - /* Constrain the position of the buffer based on the host cpu. - Note that these addresses are chosen in concert with the - addresses assigned in the relevant linker script file. */ -# if defined(__PIE__) || defined(__PIC__) - /* Don't bother setting a preferred location if we're building - a position-independent executable. We're more likely to get - an address near the main executable if we let the kernel - choose the address. */ -# elif defined(__x86_64__) && defined(MAP_32BIT) - /* Force the memory down into low memory with the executable. - Leave the choice of exact location with the kernel. */ - flags |= MAP_32BIT; - /* Cannot expect to map more than 800MB in low memory. */ - if (size > 800u * 1024 * 1024) { - tcg_ctx->code_gen_buffer_size = size = 800u * 1024 * 1024; - } -# elif defined(__sparc__) - start = 0x40000000ul; -# elif defined(__s390x__) - start = 0x90000000ul; -# elif defined(__mips__) -# if _MIPS_SIM == _ABI64 - start = 0x128000000ul; -# else - start = 0x08000000ul; -# endif -# endif - - buf = mmap((void *)start, size, prot, flags, -1, 0); + buf = mmap(NULL, size, prot, flags, -1, 0); if (buf == MAP_FAILED) { return NULL; } #ifdef __mips__ if (cross_256mb(buf, size)) { - /* Try again, with the original still mapped, to avoid re-acquiring - that 256mb crossing. This time don't specify an address. */ + /* + * Try again, with the original still mapped, to avoid re-acquiring + * the same 256mb crossing. + */ size_t size2; void *buf2 = mmap(NULL, size, prot, flags, -1, 0); switch ((int)(buf2 != MAP_FAILED)) { From patchwork Wed Dec 18 22:34:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182034 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1282406ile; Wed, 18 Dec 2019 14:36:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxkuqKAamqfvEXkce1g7kDKcBWE1cu1zTMBQ5KJWzsPuwgXURyO77fh4/+mb7WNjha4pyL+ X-Received: by 2002:a0c:acc6:: with SMTP id n6mr4816590qvc.26.1576708619035; Wed, 18 Dec 2019 14:36:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708619; cv=none; d=google.com; s=arc-20160816; b=p2xtzCDM4ED6MRp2T4qPcZ1+BVHfk4OAIrsOJPcguewrJOSoJZTVFnw6XAdjl32dcs QuMSA2SOwo7HgadUszH0H4+e2A5IJKJIcOxIQbRm5O0mG+BoHzabD2ODvulHEN5fsxE0 b8rrHYWFQFJh52qKnd9BMRYQgxLwkJyYrIpHZkdCzb7gz1aK5A5YXJs63Vsl4qLAvOmw dWjDA2kl710MIVvF/LGmr0db097e3p0TkSjdKUnGJvoY7XBwy8UOzKSzwfKfNxT9rwSW MHwzVJ+WHPW+eBnLIM/4CIu/8KsRK0WTBqV5M4dM+1nOALA/YTcTpbSTgUV0VANTnmau C65Q== 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=0o3CRcHml81TDDyh0N84h3eTIdNUcDVT7umUw0AUs+8=; b=mLgypKJcuoM/MjGZp4OQ8f55fjUYOUSGg2k1qPuaaxJWVria0zUpOo1eUR1D7UgAPi x5Plj4MiuIvanqBdRTdVrBFrabJO1sbj9LuM22mwmmsvwnbdUpCmZcZDpbqnz1jUuxtv lruZqBSZk585w+huaRg21+iYf1SV21/bfQD/hWqlc8XMNsTVAVZRUFF8oYlnAVMhebNP +mbLuDTFsKU6RHAOVvegg6mYqn3U2woiV2VAPIZ7a6b5XdBrEDWXtPXb+4w+XuXOpTgP tGIltIDKVlWcG2B9BGP1lcZoavq7s3ZW4nRpyicrkbocA5ioujW1tJtWCyCD5KlpkT1Q qq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HR2MfF44; 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 w50si2062592qtw.281.2019.12.18.14.36.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:36: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=HR2MfF44; 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]:33442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhwA-00042F-GU for patch@linaro.org; Wed, 18 Dec 2019 17:36:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54325) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhu8-0001TR-TG for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhu7-0003w1-7C for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:52 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:35925) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhu7-0003vM-1l for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:51 -0500 Received: by mail-pj1-x1044.google.com with SMTP id n59so1547428pjb.1 for ; Wed, 18 Dec 2019 14:34:50 -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=0o3CRcHml81TDDyh0N84h3eTIdNUcDVT7umUw0AUs+8=; b=HR2MfF44BxE7XuFsa+AGcR4X/1uC7IYEpME0y22N1LeDn3WNWepPKKTh2fXYxUtDvO c4gvIIBcxIWCXLYQbSITVbVEeQfCG3IRfWEz1oZnjSv5AsRDdatqvbnaKppLLNIKy5vx G3YrMM5akcZyuclfP2sjypwIWZILQQBvm2GlSGVFJuCny2fp3qMixumgb6gdpzidVnGy 0hLa8cP6MwZ/lVIp/iBu5PNFjF/GT3WzvErYUfj7zSlmN9YErrKw9iGpdIA1DKPRtivG AwIShAkgcZ0a8TGeW8m0fLShsShYwAkrvdzPAVEurBCYiIq9G7nzSnBeFfdum3r4AO/G KcXA== 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=0o3CRcHml81TDDyh0N84h3eTIdNUcDVT7umUw0AUs+8=; b=ech60G1Ee4M6z6y6kp6ZU4XDzhlwrI5TH5rdlElQoJfkFXCkEh005wI4cqLYFh78cC zE7lHpv1Is6SVcjUJqmh11OtX+KhAFEOYOdsBAkCOH1YY/2TXx7RYViAe1NpI5j5s7Cs dNJJfQBixtlj9wY4no91VDPk9g1Y7HUA+iTRJhf0ivA/DAysqzsf8zAyhLY3zLRow4Vy iQO5U87hktOgk9CGdK6Lq75YCZPo0s7xPggYQRPzQM8zXjA2ju66NGjiHt3NUOgMMYF9 j/viCx3vR8O2EhODNcxJxX7hIj2tbs4Z5M6wiUxRoMOGO7P0ug8EZSo9MafGtqSvP71n Q8hw== X-Gm-Message-State: APjAAAWlmvXz1vIjWpF75jD/lZ/RgonTZILv+rwYwIjHRLj71asGABjK RZtxsrCTuTCpKr4jExWdNJHQX8SI3RA= X-Received: by 2002:a17:90a:5217:: with SMTP id v23mr5607953pjh.121.1576708489521; Wed, 18 Dec 2019 14:34:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 3/7] configure: Do not force pie=no for non-x86 Date: Wed, 18 Dec 2019 12:34:37 -1000 Message-Id: <20191218223441.23852-4-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::1044 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" PIE is supported on many other hosts besides x86. The default for non-x86 is now the same as x86: pie is used if supported, and may be forced via --enable/--disable-pie. The original commit (40d6444e91c) said: "Non-x86 are not changed, as they require TCG changes" but I think that's wrong -- there's nothing about PIE that affects TCG one way or another. Tested on aarch64 (bionic) and ppc64le (centos 7) hosts. Signed-off-by: Richard Henderson --- configure | 10 ---------- 1 file changed, 10 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 30e3875c6b..99faf64a74 100755 --- a/configure +++ b/configure @@ -2018,16 +2018,6 @@ if ! compile_prog "-Werror" "" ; then "Thread-Local Storage (TLS). Please upgrade to a version that does." fi -if test "$pie" = ""; then - case "$cpu-$targetos" in - i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) - ;; - *) - pie="no" - ;; - esac -fi - if test "$pie" != "no" ; then cat > $TMPC << EOF From patchwork Wed Dec 18 22:34:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182037 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1284869ile; Wed, 18 Dec 2019 14:39:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyaUKUURmDULSLN5eiL0wl8o6dpMGBbWooatAXqNBtheDIguOjrmY+tRqS5pezGy/pbDMxu X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr5239126otq.75.1576708787635; Wed, 18 Dec 2019 14:39:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708787; cv=none; d=google.com; s=arc-20160816; b=eLzT4x32GUE8TNcZlRIPo+1qKKNjBSxQpx/da4jZA+UiDiVSk6j0NHVQVnOzM/EMsn 1+26E/9XAJzLprwwGQdx1chRF8xs9zELti9MUuGU1+Hgqg+uhoS6yi1tvPr4u/C5OZgu lX7ftzUXc9aKwJGVC4iEW5ViYPBnLE65dJPKBFvu+bRiIp/VSFVeD4iEdeHvkQRHov1G jFVOrIDKj3j5GiaZmiEl8NSzkSvzdXnvkQ+3ilXHxy5GdIQBEmYKbWPuXJG32z2iuPuW 0nw6fweqCsOFlMXi0Rl3pEB0cur/lXXumyPR27BmEonWe1NMAOEHOCnIrCttuN8bkgKO jCzw== 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=nApRZuyphk20QYsTZlcyHkybuciklnqNiVIxVWJIGrs=; b=EIZuiG1xbr7s8pZqmVlOosZalImSxI2DdymFx73TyUkjb8rS+aCh2hMxx1OxGx3Rja dEz4TciV2qfTDfBPyUNVWiAiNhpNo5jupf3iMpPfrj1ulUZEOF3Z/E9yXZdaWDa0wa5t moC7NEf5Uj++xetpkAM9ELixfC3NQxLmTidaPKw+Pq+iW9Ys76Yz11cUUNOedHRS0lFs RgjaHSPeaMoMhhHEy5e7ab1CIxyVpz7Xkj3HnukbbKGpNc1WQUeUB/dt3aclwf4nDcEQ RgqkDCSL3ASYQEZM0eSPF7fJZNAk21gsvggMAwqtcNnEXUVaNmvpdgHyJQyPbe3VthIa sqUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=peic9dvH; 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 m25si2082322otn.208.2019.12.18.14.39.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:39:47 -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=peic9dvH; 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]:33490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhys-0007kp-RM for patch@linaro.org; Wed, 18 Dec 2019 17:39:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54375) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhuA-0001Up-F9 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhu9-0003wn-0c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:54 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:53196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhu8-0003wD-RA for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:52 -0500 Received: by mail-pj1-x1044.google.com with SMTP id w23so1538950pjd.2 for ; Wed, 18 Dec 2019 14:34:52 -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=nApRZuyphk20QYsTZlcyHkybuciklnqNiVIxVWJIGrs=; b=peic9dvHg0FZLS19Thrdo42vWWlyzsc1NRmi9oIJyqhEkzB4O52jcu4+qpBeqPcko8 G3P779Vn9oYD+1087jriTUnZR9YO5uiMAZcyRANWNrLg0FS9Fxmc01bP+AOcvohKUKt8 teFU2jNS3TbmACMZwqFTZzCW6cG7gWrVHY76DSRcfBVG3WbbACwE22G0bajiowLbtzzL EMXzYPJFGdrjd4Jp0prybUjyWIicR4xbrKDUS3QKCvdSQZ0WrcZki3/vhjV2rK1M/48b pnB+WzJFb5gAWgWmlXCJhwZaBWPTwRHU/NFXemGdBcDGOJTZmdNJdo92HxuZqyffHcUM Ya9A== 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=nApRZuyphk20QYsTZlcyHkybuciklnqNiVIxVWJIGrs=; b=C1q4H5G+qSFLPmgVCvArGH+kIyVFA3IJ3S1H2Ocs31q3HnCKhKWXHc9yzI6tLVAw3E pmUwS0fO0aZ6t/JDgJKP3/Cb2qPXLDlvFWcJlsEdr25lHI5jZ2CSSXEoXFIWKANXejd0 B/+ZBq3/p7ksaicEO50c1YVE2PxB7SFux/c4Ddx6GobZ0dZ4tcALRQStQAlbT1MK62Ba 44YBexhO5mAAgwZcESbOsP3Ki29sVuE2oFyAhLfTnVHd+IAK651U2PPVHBvuTxfAGqdn Ya2vS1ZALJj5eCPmQL6qdcMkkdSU3hgITPhI3L10iYU5vSc1o++G2fJ00Qxpr3EbTe8q F/rg== X-Gm-Message-State: APjAAAUYaxeDHst3Uyc+C4i7S0SNQsZZ8PX3LfXLFzT4CvKhXL+RNUd9 QOpkv5FAzh1nbZb+TgDdKtIvsjBwyuA= X-Received: by 2002:a17:90a:f494:: with SMTP id bx20mr5727450pjb.60.1576708491152; Wed, 18 Dec 2019 14:34:51 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 4/7] configure: Always detect -no-pie toolchain support Date: Wed, 18 Dec 2019 12:34:38 -1000 Message-Id: <20191218223441.23852-5-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::1044 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, Thomas Huth , i@maskray.me, berrange@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The CFLAGS_NOPIE and LDFLAGS_NOPIE variables are used in pc-bios/optionrom/Makefile, which has nothing to do with the PIE setting of the main qemu executables. This overrides any operating system default to build all executables as PIE, which is important for ROMs. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- configure | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 99faf64a74..7a646ec007 100755 --- a/configure +++ b/configure @@ -2018,26 +2018,24 @@ if ! compile_prog "-Werror" "" ; then "Thread-Local Storage (TLS). Please upgrade to a version that does." fi -if test "$pie" != "no" ; then - cat > $TMPC << EOF +cat > $TMPC << EOF #ifdef __linux__ # define THREAD __thread #else # define THREAD #endif - static THREAD int tls_var; - int main(void) { return tls_var; } - EOF - # check we support --no-pie first... - if compile_prog "-Werror -fno-pie" "-no-pie"; then - CFLAGS_NOPIE="-fno-pie" - LDFLAGS_NOPIE="-nopie" - fi +# Check we support --no-pie first; we will need this for building ROMs. +if compile_prog "-Werror -fno-pie" "-no-pie"; then + CFLAGS_NOPIE="-fno-pie" + LDFLAGS_NOPIE="-no-pie" +fi + +if test "$pie" != "no" ; then if compile_prog "-fPIE -DPIE" "-pie"; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" LDFLAGS="-pie $LDFLAGS" From patchwork Wed Dec 18 22:34:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182032 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1282329ile; Wed, 18 Dec 2019 14:36:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxk7yv6g31A5IvZM7pnvjWJg/gzXdMwdyAqCj/4nnWS3ITMTk8vWr2XBD4HIsVnM65OPyms X-Received: by 2002:ac8:4515:: with SMTP id q21mr2576534qtn.376.1576708613548; Wed, 18 Dec 2019 14:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708613; cv=none; d=google.com; s=arc-20160816; b=SrfZV150uGG510C1EQziuxeW2l2BmLcJt4EhJJyUFiEoUQyi2ncV7I0u0Ci4WHzebo kSzHepMv4UaT4NzXkxByqNjXkRx549iJSK5V2pZLpVVh2IpqpXALS1HYirhPnIdl+Qez UicA6WRx/lJfsFI2FW55sMYuSInFCDhSlUViCyg+WTfloev9CotD7zZJGMlWRF/i4Scv cIK2sYV3XjusRLg8boxAQOu+VfsqmZj13XZilCpSU/ZdWsafXScBVh8xV50u8kc5vRtx ck9zUBBsBRBBcflMDcbHuC64Cb3KIxy4sOgPjAg7uPW7Ur/D2SiHR7BJx7jYUwoF+pK2 Yw5w== 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=jITgTjhnj7lyoJXWYxFS3Q7b9u1xGvXARpfPJEwIkz8=; b=Q2ysss5Z+XIeEQRwRliBKS3LXN4BIlYpCGoLJVL+HENE63k6PGA2z0piA0cVc9rEk2 ZNKOiO3L5oL2PLV/kyoTY9grN3k8mr1C/pcN3oLoog9ibNte0YwzaR4x1rG5LKZLGQtt TKYo8UGljatQpCtBhZDYiD35KUaSuOFuVKSUV9mZA7PJ2QEHRZdSVKOmmDVUyFQ8nO8H Q5GTxFSrpQNDRFJY6FxMzP793vvdGZsD9/jmG78jCu+coCI1llqijm+dcAsTq32M780N YISamqI7Ub2k404zLSHregPMwf9Zo3lq3mgllib1J+1n+kwMeTwhxuCENOtYgUgWSajs NTCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=O6bFouSC; 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 s8si2798679qkj.85.2019.12.18.14.36.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:36:53 -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=O6bFouSC; 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]:33450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhw4-00048a-Qx for patch@linaro.org; Wed, 18 Dec 2019 17:36:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54401) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhuB-0001WQ-Cf for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhuA-0003xP-CL for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:55 -0500 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:45853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhu9-0003wt-Ps for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:53 -0500 Received: by mail-pg1-x541.google.com with SMTP id b9so2005332pgk.12 for ; Wed, 18 Dec 2019 14:34:53 -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=jITgTjhnj7lyoJXWYxFS3Q7b9u1xGvXARpfPJEwIkz8=; b=O6bFouSCNjB/kJSo0SlUL9fYP6wBEm0D81Yltp3OMNSyBtBbFfuANiM0v7OMCpa51A L14pvnOtRr3AhqtRh+GcGey/jxN+uhM/d3IYmc8Dp6+EBJ//q47LxdA4/XJcz93bDbdk SyWOZTKPrKNac2je1LDlmkq8Pkvu1vYNHKvRjYJYH/pbuit+H094ChHn3UlY+NfGR1FK 9ojGVZE1DsB5WIGvfCXbODlRMU0tQhfEXdv9SB41OjmRy19+O+H9rvN8uEKvjMfGQSIs jJEVMRb1muo5BPrRZKcy7ZFir5cU2f1EpLaysSpKQZJVdxALyQOQCNcpkN3UU59EAmPc NmXA== 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=jITgTjhnj7lyoJXWYxFS3Q7b9u1xGvXARpfPJEwIkz8=; b=GK6oDWCdOAe3m8XmiChv0NE2AqafAZ8sFw1TzjnlQwjN/ftKc1HG1Ey6DuMazcSibh zP9pNE0Iri5DeAH4LDrqLkYeKXW9LEh1CNZEu/FMJDfCA2kYL70zu6VCugfrOpYEaTfM JxM3SEWU5pE9rs+93+/KrfslSK7kjF9LfB1Q4OU7tasXUocI/eaRZFBPrB2Pi/4EKXdh sS1E6pJFNyf/eP6CnA2Vaq7AYdbDEhrqKHejDUJ3XTFy07mcKg6zPpTXm5JGfth1XrGc KChOoYlj3wA65svEY2GC+Fy+uUc+kY+EWpuFYvVl5X5C1nVftH0LX+tCTpHb/+b5ARhU 960g== X-Gm-Message-State: APjAAAUF2XZTDNv37hHlfOLtCRIZT/8AMQl+pDjMz+LfJViOVFs22NPE 3raJONzLRl2A8cDHyc7IcuV+wfKrJ5M= X-Received: by 2002:aa7:9192:: with SMTP id x18mr5783182pfa.125.1576708492563; Wed, 18 Dec 2019 14:34:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 5/7] configure: Unnest detection of -z,relro and -z,now Date: Wed, 18 Dec 2019 12:34:39 -1000 Message-Id: <20191218223441.23852-6-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" There is nothing about these options that is related to PIE. Use them unconditionally. Signed-off-by: Richard Henderson --- v2: Do not split into two tests. --- configure | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Fangrui Song diff --git a/configure b/configure index 7a646ec007..2503288654 100755 --- a/configure +++ b/configure @@ -2040,9 +2040,6 @@ if test "$pie" != "no" ; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" LDFLAGS="-pie $LDFLAGS" pie="yes" - if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then - LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" - fi else if test "$pie" = "yes"; then error_exit "PIE not available due to missing toolchain support" @@ -2053,6 +2050,12 @@ if test "$pie" != "no" ; then fi fi +# Detect support for PT_GNU_RELRO + DT_BIND_NOW. +# The combination is known as "full relro", because .got is read-only too. +if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then + LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" +fi + ########################################## # __sync_fetch_and_and requires at least -march=i486. Many toolchains # use i686 as default anyway, but for those that don't, an explicit From patchwork Wed Dec 18 22:34:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182036 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1283845ile; Wed, 18 Dec 2019 14:38:41 -0800 (PST) X-Google-Smtp-Source: APXvYqz4tY3PXu9fcZ97/D9mFEmWCtjnijCtZZ8Koh5GVJrSVbm8wKgINIgvULI5aQl0ZkjXE00A X-Received: by 2002:ac8:6c5:: with SMTP id j5mr4589561qth.284.1576708721257; Wed, 18 Dec 2019 14:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708721; cv=none; d=google.com; s=arc-20160816; b=Cl9ZIdNJ3We4sNFOyjUiSrZCpVzvpGiPVpoyy7rnl0tRpb68qQsdt/LoOP0itXM7Ve SAMRIGULOsB5fP0wyG9lHi2RZIah+veBpDJwhcktZmQdiIBsiu+IfKPodsfxH6jIATx3 OnH8S9XkiFAzJwhPn16QTTJhNu1Q4cQinMnbmhPPK0fYrwXXpRWoqAzhPhcPE709z9ZO d+VGJbuSh+qz22qng7h7YgWfY1bzYfrzsnihytdmeFEaT4QEcS0tSePtf94RvsvbUsLl G2oM3Qdx694TsSWlf6MY29LYdqw5rkyuEY4YHaII+4LIf+QIBHosK2h8mEDjt3cXZPM4 NLuw== 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=U++KNLczq+T0iSXhRIdVMellsLpueqaa5pKBG4Au/Xo=; b=UKk2AEKacXaddxs/xjZMIAizpvIcsEAgfXBxG7iCY60C7I4AMBnl88eM8fTJMY+4xQ QiP5ICEDgkNXSCFSzFeK9V/gszpokZbGgWXj1kBqgfS32BkarDkO0uaLofjjdqsv1wWI hei9OzF4/gjTDRl1Wa8IhSCKotlxY4m0hcoFuS+xws3m6fu2y9PfUVWySC9fjwvXGjxG vTsl3PeZTDSmph8Oa5DU4Q5kFiqTlEFuRuC4Ew5A9q0ID+i4K7pCBVYR232aO+KUYFsH YWdS3wKoby1fx66o8E9MMb+0kSRiw6tPei9S5VJf4zsdD1c+F9GyqiRilFjS9ttj7jJV fWxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=veaVSP0y; 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 t27si2172661qvt.34.2019.12.18.14.38.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:38:41 -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=veaVSP0y; 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]:33478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhxo-0005zk-Mj for patch@linaro.org; Wed, 18 Dec 2019 17:38:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhuC-0001YP-KI for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhuB-0003yA-Ir for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:56 -0500 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:37215) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhuB-0003xm-Cy for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:55 -0500 Received: by mail-pj1-x1043.google.com with SMTP id m13so1545084pjb.2 for ; Wed, 18 Dec 2019 14:34:55 -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=U++KNLczq+T0iSXhRIdVMellsLpueqaa5pKBG4Au/Xo=; b=veaVSP0yzNYOIt1Y7emls/H5UuzaSVzRv8gD+Z7MtnHFigqRMtdc6CVY+d018N9v4G cz7G71bO1yg5cOoKr3zPp7WcZLmD5Grq0ZRQQbk055g7PHDRzqMLJcKzFIRpdQGELbA+ IEgOdBRbgbZy//jvG95aFfg5c+1EgPuserCtV3MNSvIbk7gUuuQHPf8XMYJxz0Y59485 2l+nIUh16JZ9ityDbIQtaPkFWGCVb0fDg4UuiBG5wegYOBwL8BK01UQth/xBY65Aw1jb NRsL/2YvEMAbUrbFuOHS323eO4Z2vwW4mEog5JHzASS2d+owmPBaVNvg5NMtKJQEPLaN 1MQA== 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=U++KNLczq+T0iSXhRIdVMellsLpueqaa5pKBG4Au/Xo=; b=GMPQGNDoVBMuIeD67ucSSXtt8MVLFJ53OlhnbyGU5U5fVu4OzCwwrwfN5ED4aVDjyQ vzBPoBUjYV7GV52qrJ6IQ4V/kHVuwKrtjk1aoILhghzLpsT7dSeh92liubKOpSu/qyCM SjjcN+7NegehSaBCzWSqx1GkgjIbAm7LSUehizsNZ4ZNiKvkpYxAu7erDwefw7u+niEX W4bLb3lthIZRZ6AMEtvcyTSKciVE01C5TvNfMEI+aDQn5gkHsRSxLr2CpSqJy+LIrICF o2zVhWag4uJbPhv6fvipebcgC0+20fyVLloEG2OQ7V6o5nVwaqGY/ytfVGlQJS25XzSc iZgg== X-Gm-Message-State: APjAAAW1ruB5pnL16SXYzNT0bdxwfM5hrOfmc0LPeQSCYaInIGVhuz7e o9S2VRJQlXgeQ4dZs/VjI4s8zy63N+M= X-Received: by 2002:a17:90a:6:: with SMTP id 6mr5808158pja.71.1576708494153; Wed, 18 Dec 2019 14:34:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 6/7] configure: Override the os default with --disable-pie Date: Wed, 18 Dec 2019 12:34:40 -1000 Message-Id: <20191218223441.23852-7-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::1043 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, Thomas Huth , i@maskray.me, berrange@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Some distributions, e.g. Ubuntu 19.10, enable PIE by default. If for some reason one wishes to build a non-pie binary, we must provide additional options to override. At the same time, reorg the code to an elif chain. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- configure | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 2503288654..f6ff079fab 100755 --- a/configure +++ b/configure @@ -2035,19 +2035,18 @@ if compile_prog "-Werror -fno-pie" "-no-pie"; then LDFLAGS_NOPIE="-no-pie" fi -if test "$pie" != "no" ; then - if compile_prog "-fPIE -DPIE" "-pie"; then - QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" - LDFLAGS="-pie $LDFLAGS" - pie="yes" - else - if test "$pie" = "yes"; then - error_exit "PIE not available due to missing toolchain support" - else - echo "Disabling PIE due to missing toolchain support" - pie="no" - fi - fi +if test "$pie" = "no"; then + QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" + LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS" +elif compile_prog "-fPIE -DPIE" "-pie"; then + QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" + LDFLAGS="-pie $LDFLAGS" + pie="yes" +elif test "$pie" = "yes"; then + error_exit "PIE not available due to missing toolchain support" +else + echo "Disabling PIE due to missing toolchain support" + pie="no" fi # Detect support for PT_GNU_RELRO + DT_BIND_NOW. 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