From patchwork Fri Mar 27 22:03:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185026 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1827021ilr; Fri, 27 Mar 2020 15:06:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vulAUic57QzdJIYzY+2Bx3mULK0OvZnSTv+o5JU8KEcnU74QT8lN9DEP1xYlcJT6nHhoFWG X-Received: by 2002:a05:6214:1449:: with SMTP id b9mr1430541qvy.217.1585346813481; Fri, 27 Mar 2020 15:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585346813; cv=none; d=google.com; s=arc-20160816; b=K9CowgmXdmTQ63wGOzqs7NIDIhRmoXGnthBDW+4sRiqE1mlbuytYgred8/OHQ/+pr+ Y/FB0c2MCuFborZfC1dD7UMauxSqHqLd6NBtfb9bDR6I8qMN3Cy0rkwIlyHHVGh6hwSa PqKpTcjFrZN567eEQsOMefiIDqeZW/TyfpUkm5/n16BNPefGQIme9RRlO7EXI00ssQBA vPIVaie9nEtpI7D3xXxnDBLsaVgVXSuFiF5N8c70my5T8UYxeYloHsyn3xtv0QA3A6d6 8sFlZg20krZymQ79ZSmpVW6h6I0i8IixkAbpmxiheFqxDHzMcIxOcMmwrKt/EMVYGnaG N8oQ== 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=y0Khsh6UQLm4SSnMSPV2VuzsbkNKE7igcenjK3oMio8=; b=kfM5o3IPaXms2GO7ARPgAAGT9otjszSDH9TNYZntGVDdu6zeu4smxYUoRMF+p7wfIs 51kCjuUhoWrsGJaUCVk+nDD4Z/VVFoQsuLpcOIZE3BbEqbl879aTP5YD96p/6mV8p7qJ Wph3klLhooongVEeiDbwgOLPWdDx9UvZavj/pEtbBqWiGs0w9uAVqgOytUjMqWI5xQbm 5yZcvcVEqbDetmpTFXzRC/xRvSfkB9k5QzFwi8DZkN7/Vij0D//Hr40fNo++jpJfEZQZ DNsayUeQd+Rl6o217lXkCTIDe5k+zThuxe5WqDul87B+jcdVOQZwOiDtzCTXvTrovw+4 +6xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kCDtsAJo; 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 6si4253444qth.281.2020.03.27.15.06.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:06:53 -0700 (PDT) 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=kCDtsAJo; 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]:47572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx7s-0006rX-TY for patch@linaro.org; Fri, 27 Mar 2020 18:06:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49238) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx55-0003BY-SH for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx54-0000GY-M4 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:03:59 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:33229) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx54-0000DM-GN for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:03:58 -0400 Received: by mail-pg1-x541.google.com with SMTP id d17so5243552pgo.0 for ; Fri, 27 Mar 2020 15:03:58 -0700 (PDT) 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=y0Khsh6UQLm4SSnMSPV2VuzsbkNKE7igcenjK3oMio8=; b=kCDtsAJoGFSOUFY9lAEXvEM4fSsCch7Hx+ApDoq+Xdv+o+cFwGCqk8oNAV1u70exk1 OcJQ3hQbBqoyw/zZJy57tf1e9OrnGzbso8Rh3P+bGuMEpvx2roKEzRewoFeRLHAEJgqm SxdPzQlu0ZfSh7VbBGMDtUbqYgah202fhyS62CeROp8l/dBHtka42doOO6sKZgPJS9gV WjmcIFdsli9sRfnqChX0s8ycZZKo1g7mB1WAb1/EKbVU8ZVqHK70/MbvdxKoFq5jSR4d 14uDSWZ/7eD9RQNNAyaF3Ro27Rehxflvcz0ZX6lgQZCVSiUsZMNMPS2590wB9a7LWLXQ 17iw== 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=y0Khsh6UQLm4SSnMSPV2VuzsbkNKE7igcenjK3oMio8=; b=m4WHrUFDeWvHyD1vUbzQsICMSwmqve8NA5ItOKAktfKvLGdr/miO2xdPMlIoBiwfmm 5Mxl8hdYzvnjFMKJz/XHm80cYoR+5KnOvLHjgNHWW+C4ix5XuEnUVOWRTCRS4BZE+BJq gF171eDLEj8wLTVeWmsAHL8wltrkESV/cozc4K4Yc/AtL68trqpdryiO6UhVcH9T+XH/ TuUGwWt9eshSjha00F6MltxTYU4jmGbyQrkEQfB5s7MKMzaVCi05VphxEVHm1dNgSzO5 DXwVxYFULu5spYW9zJEgZ9vMHvisa9OaEeb1n/Ld8oCIKRcWhktPnj46oEt84UuuaMvf hLjA== X-Gm-Message-State: ANhLgQ1LQJF3CGMa2iKWWXZaH222B7Av6PfuFIeT85QWmOAQS/GFVn41 7RTGu5wJXVlvrMvqh2csIrOHhSiw3YU= X-Received: by 2002:a62:fcc7:: with SMTP id e190mr1345817pfh.285.1585346637131; Fri, 27 Mar 2020 15:03:57 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:03:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 1/7] configure: Drop adjustment of textseg Date: Fri, 27 Mar 2020 15:03:47 -0700 Message-Id: <20200327220353.27233-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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: dim@FreeBSD.org, Thomas Huth , alex.bennee@linaro.org, roger.pau@citrix.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: Alex Bennée Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- v2: Remove mention of config-host.ld from make distclean --- configure | 47 ----------------------------------------------- Makefile | 2 +- 2 files changed, 1 insertion(+), 48 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 89fe881dd4..2afcae61df 100755 --- a/configure +++ b/configure @@ -6498,49 +6498,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 @@ -8175,10 +8132,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 diff --git a/Makefile b/Makefile index fc2808fb4b..84ef881600 100644 --- a/Makefile +++ b/Makefile @@ -795,7 +795,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) + rm -f config-host.mak config-host.h* $(DOCS) rm -f tests/tcg/config-*.mak rm -f config-all-devices.mak config-all-disas.mak config.status rm -f $(SUBDIR_DEVICES_MAK) From patchwork Fri Mar 27 22:03:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185027 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1827179ilr; Fri, 27 Mar 2020 15:07:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtxK9Pd4RopMDhJWozIbp2u0QkomhGZLOTBnb456h+KR9Wm4YhlR0ZoOQkCBkG7GQfeQdAZ X-Received: by 2002:ac8:4641:: with SMTP id f1mr1447701qto.216.1585346823838; Fri, 27 Mar 2020 15:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585346823; cv=none; d=google.com; s=arc-20160816; b=L2dMN6xqbZzLtdoHRDkpDSD4RtQiBtJnO/1dVKLhItRdcHY0XmBkRWYjXg7Pj34gJe DCZ+YfIybIeZk7fgAQaVnLU2DIdJYf2QXPg5XMbdQ8eXXdwlfNXVGb33+vjkwoA6CLt+ OeGM6+tJ+KE/UrhXxez/igFHp0dlHMQD6HtrrOS/XyPpQJV4ji8hSq50cXFe9qhZz+Ci Vi6qlW7qq6lN0vl0fGUK0oNAMsPjNqU6Rpmxpvp0+grLIdEejRWvAV6qXEcYAL/+V/+1 otaDcAR7mMj1IdPsxtbW7d2R7Q+2HWWolj2SxeGTzbAi2jNfIk3gnEAwLTYAujeTttRF +YCw== 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=AVWo3TkNC8dRck4gxr30FMdUL1YEqwhhQceYuT351jQ=; b=czLMdPQOT6+JxySqjKeWeRGPa0DIfYlYwKBO2SILo7+79etrsMvOZYnRpmb6lY6t5S h6Zi7P/PSHeUbzkdFET/98f91fBb8KhXG6Xw3h+eJytwR9dFb0ajjJcbijgORgZd1LXH /REKNWSMUhQADfMGTX+DoBCZYQMOxcgoK5H1OPynjee1YFtuHIvMb96/i+k+d5ZQ6LU9 uW/3U1o8bH98ZcYpNtRlLtdo69h3XTk55UR7r1RGGPGl1ewbyAXG0GwNvL7vCXYbi3nX 3IqSJCXnvA80cAJh82lgY6QhkjnlDDxqtK7RlPRlmXQ9t9sLV2c3tpGEcMRaOmLB4V1r DCVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TywaZMPB; 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 c188si4022004qkb.310.2020.03.27.15.07.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:07:03 -0700 (PDT) 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=TywaZMPB; 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]:47576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx83-0006xQ-Ay for patch@linaro.org; Fri, 27 Mar 2020 18:07:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49250) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx57-0003Bj-5x for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx56-0000Ox-2Z for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:01 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:46339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx55-0000JZ-TF for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:00 -0400 Received: by mail-pg1-x542.google.com with SMTP id k191so5213653pgc.13 for ; Fri, 27 Mar 2020 15:03:59 -0700 (PDT) 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=AVWo3TkNC8dRck4gxr30FMdUL1YEqwhhQceYuT351jQ=; b=TywaZMPBxS36l1077IGjGjRIwMvxk6h+ckm+IZ2ZxT4wkG2fvSASNvVRwC74lg9IBK RWkYPVXbZQAS14XwoRydTHccywGqvyxEkIPN7ZOS6BvLsu6whpessyympzMfHn+HYXF+ qvw5DExOM13dPeQ47KUW5HS4R5D8xbFTXGg42zLPW/wfI2CEX2KrAF043ZuHlvBQAf2T dJzB0IjhjhgL8l0kLQKx7JGmlsxtWUWuh5Z5a0wFlgoHtzNi327oSNkmLZIAN6BF1oYN hGETAKSoHICMbT30GLiwyV1owGs0wC/8gqhvoxlLE+UvISSvY+oksTaE3wPrOderYn6h ofQQ== 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=AVWo3TkNC8dRck4gxr30FMdUL1YEqwhhQceYuT351jQ=; b=akpbeSwfR7OnNhyCpcBX6wnoHw6NwlbpSfIrgLWEKBPwndcs6gcPCH0SXFwK2rzAMF BqHXE85gIKpRrIysqWx+8YtCfaJp95fZRBeV50lUSuI7SwKSlpte9tgJFXHBIwqIQKSQ 806fP3SfeBgT5Ti76Wp5DNxEuhvyafW7CSY+mvnMdVuDjvPpHuKG3cVr3Y4ja+qc9j6x 9gC7IS8PTIaZugnBo+POtKwJ0pDtvXKc5vBodfnsrGCJINpIJI/SRUwLbSqKcVnpD7A2 G3xeIRDT/hPafn99eRGdezItIh54EYRJf/06C6hCNKp3sPbDd/UVL9qFlbaB21hW+df2 CP6A== X-Gm-Message-State: ANhLgQ0u9xZ0k+6ALu7CP6xaJa1fiR8J74NhN+b+agBGjKH1qkMuAUKI MQbtiXoiCxzg9gO4parFzQNkMQRVqdA= X-Received: by 2002:a63:bf4e:: with SMTP id i14mr1405683pgo.41.1585346638398; Fri, 27 Mar 2020 15:03:58 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:03:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 2/7] tcg: Remove softmmu code_gen_buffer fixed address Date: Fri, 27 Mar 2020 15:03:48 -0700 Message-Id: <20200327220353.27233-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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: dim@FreeBSD.org, Thomas Huth , alex.bennee@linaro.org, roger.pau@citrix.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: Alex Bennée 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 78914154bf..9924e66d1f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1043,47 +1043,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 Fri Mar 27 22:03:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185028 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1828965ilr; Fri, 27 Mar 2020 15:08:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vurHA6v9AjAjE9dPr2ThpWOjuiJnviC9GtED6UPfljiNu8dN3sIjwx9TBwV/1tdD+mMttX5 X-Received: by 2002:ac8:33cd:: with SMTP id d13mr1480126qtb.265.1585346936507; Fri, 27 Mar 2020 15:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585346936; cv=none; d=google.com; s=arc-20160816; b=qPP6FKUo3kK6vF4j0RUZgzSv7Aswu1VbWu1qGa1yiBDdpzYLq41ff+RV8qQUEyVYoy 10tzWUrSyBl55RqnnmsM25aZYGHJGBpI1kd95eQ8n+MvyCvKyKtKkzAo0P4oqfzvK/eO I3Bk9ywKGC6hbwLcwTA4TkpPknyn850SJbcvFPhnTw3sN4v72MLOxvmS6p2IkdmSdMIz s7HylCwJSEs0bchxB0SbqZ5FH1Nqglb6FT49ymDpJPiBHY8SA67GmgL5F1ua8ia8pmAz p/U4gigbmC7zx34FbQH/jr812ux6Dqu/yH7xSQUDNCLqc04gklK7376vTHuxrrtspwYG ABzA== 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=o9JKpzI/epj4oTMvrkZSj1+UhfI0QZGWg+p5R22DKV4=; b=pB5mEkKoABHZlL8kvRw8fXxj9FBroR4IenBSw2AaAObTPPOrpFTGGMxJtDNJodNgTS gMFbEwbyIwfoo6aoCalud7tt3cFlbNX2TsHmlpTX4IReRsIoKNhIogSmw7rMBvbsr/Wi 7Z3wwwY4CFTr1vivSDSLw3SEQY/2zs0HxePmn2DhGVIQ2Allz1bceuRKEbbSAHCCoJAj qtBnihCqU2hZr44g6VMu2vejklnFjCXQ3inDm9m4zyp/LD4EdpJyPvnrRXEHOekG3r5t k6foJvrkRNnhDv/pFVTCzUaRog6XzdJruAQM7jtNzdUS6vkMVU2vUhtDb3wcosAjHmGq jaQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eBqtBNxX; 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 k5si3808943qte.315.2020.03.27.15.08.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:08:56 -0700 (PDT) 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=eBqtBNxX; 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]:47594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx9r-0008Mx-WA for patch@linaro.org; Fri, 27 Mar 2020 18:08:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49268) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx59-0003Dm-EL for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx58-0000Yr-Cy for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:03 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx58-0000W8-67 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:02 -0400 Received: by mail-pg1-x542.google.com with SMTP id u12so5220731pgb.10 for ; Fri, 27 Mar 2020 15:04:02 -0700 (PDT) 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=o9JKpzI/epj4oTMvrkZSj1+UhfI0QZGWg+p5R22DKV4=; b=eBqtBNxXIBOxeXQY8NqlCB7pb3vAtGykDRG6rNeEQlvdzs36JRFf4qCAm1SVErhlOe R6ltlBev+GqfksWLzEVfZ3yqoLuU+npojA1N/XHZPK+owchAdjT0MiFAvAxTI6qgyxt6 F3XOjwo1Dvs/ATrN+2NfZsEmoyolH99WBbSmmvch5jGsUypTgp2camMIIYQIhlgWZ7c7 QUCkyulUIxUpC6Sl12L4TT66LgXADmuEnpG9/u+6R4cVYDCaP7bZbrwW2Eyubd+xTLYf JQ9E5CVLU9bhG/xkQgBkpnnSQCnQwkUAABgVWWpfNGwzO978/eKUUWXAbahTTENtPAQj hdrw== 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=o9JKpzI/epj4oTMvrkZSj1+UhfI0QZGWg+p5R22DKV4=; b=IkMOA9Nvji4ttTLwCI8Lwe2GNeIWLME8AVlC9W8FtL/fqjtZ5riay9nmphrA3FAwsd fsltGhlBTJ/L5j+CQ/nkiBkl6uX+w+fF4SiLU9ksG7IVtCCSJAZv+LMoHWHTcyPekLLH dChwHcVpSm2GULzdLAqIDxyvp85vhlU8TwhdFBre1t/cpC/EzEIUsQOF+E+IM8HtuFS5 iO1/L5SGUMxB9d5y+4I9tG+Fk0WgiVVtGgB5Roga0T0zy7pK4B6w8F5FSln0C/NTPpiF hNKnn1sPdrsArV2RUYOsQBG5IU2prcCF2GeBQeNVY2O7+qEbRnqepvasjoCcsPQy7us3 cQyQ== X-Gm-Message-State: ANhLgQ0XQakGtUTyQ4i20vDQ9PVYmlW3DP6WfxX0xvI0gucQ7jwl64Fr VjNz8CjHI/VLO1IzuJ20rZ1VcjZyITU= X-Received: by 2002:a62:1a03:: with SMTP id a3mr1345219pfa.171.1585346639574; Fri, 27 Mar 2020 15:03:59 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:03:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 3/7] configure: Do not force pie=no for non-x86 Date: Fri, 27 Mar 2020 15:03:49 -0700 Message-Id: <20200327220353.27233-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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: dim@FreeBSD.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , alex.bennee@linaro.org, roger.pau@citrix.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. Tested-by: Alex Bennée Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- configure | 10 ---------- 1 file changed, 10 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 2afcae61df..cbde833f6e 100755 --- a/configure +++ b/configure @@ -2107,16 +2107,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 Fri Mar 27 22:03:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185029 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1830089ilr; Fri, 27 Mar 2020 15:10:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv2oIs0tn+g/FWeR3t11Ojt1GZ6lYe3uOJE6SBKa21VTKpjPCdXQYDMgJmHv/W30kTyVVzl X-Received: by 2002:a0c:c311:: with SMTP id f17mr1498164qvi.146.1585347007277; Fri, 27 Mar 2020 15:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585347007; cv=none; d=google.com; s=arc-20160816; b=ZOlLWriStA4/QR7cPhX/mmaBtRTFvNRqX9RDbOmAj3NKfQl09W00n20n/XTBmY09/o KDbMAHj4xbARsSuLGmDQOu1accIcWgWbALKjdrSYfm+SFuzie1t2eQvBknR7BlZSdDxH CNZDziMD296xQYgEYoWuQytz+OVe9dqyuq4a7aAcD+EWcV4cEH/b26rTSprE4RZ5Fj36 FoNNlW+kOm9qPk4NfBreDqLp4xRDafjz1FeixNbo6vVRUcHWkvc1jQ5YiuVT0Dgo9SyQ 24Y5nWwnGweg5iSc0VvdYyjpWT9NytdKiyOnZJ051MCf3VRXapxYhQju8e9uABuV7zFY Wfxg== 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=cb2unVg/y3kPzR3lxHeExP2weV+dUFcGMy6C6nOZx0Q=; b=ghOXDBFc6N8UlFKnpWem+7ONyFJFtUeNfF2ikWzGDXuRAv2f1CXBNta5uE0kytHmn5 ucGeLxug85BPMzlnNdaaoliOdYMPFsgYKAYn56dwJHLyyQMJm7+NZ2CaKNQm1p8lATL4 ZZ8hcNGNy9mQnCICwLtBPkTAw3yboM5vJ2Z0CDEIAdoZglnFgfJL8E9rHmJLw4Z/P1EN Cq30nNU8+bYtvxXGwZwzvGNcob9Gm96WiIcU1yI0iKeYsXD8Tl9AmyF+v7W6IDdYP0UK dx9SHXNnwnNiYiPjzUa6a8EcGFuLNyszLQmRpk1Mr516I5SXD1ElyzOYV+2yPsg/tRml bwgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rciY0xXw; 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 d185si4299722qke.338.2020.03.27.15.10.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:10:07 -0700 (PDT) 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=rciY0xXw; 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]:47616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHxB0-0001CM-R8 for patch@linaro.org; Fri, 27 Mar 2020 18:10:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49271) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx59-0003E9-OT for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx58-0000Zs-N4 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:03 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:37492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx58-0000XD-HX for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:02 -0400 Received: by mail-pf1-x441.google.com with SMTP id h72so5151616pfe.4 for ; Fri, 27 Mar 2020 15:04:02 -0700 (PDT) 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=cb2unVg/y3kPzR3lxHeExP2weV+dUFcGMy6C6nOZx0Q=; b=rciY0xXwixWMtFjY9FnLTIKNpNa8jYlmscZG59dmFxKZoLNZo3RwfDya2FtY2zwN4d TLpCytN15We2Sc314zGpSLuahtx8bUcqfsOCv3BQ04mF04O3b7v+SVsRqroS12o30bDW iAEWr1eQZH266xgEfwJICt+UByvCVB+HXlRgOLm0UgaUSOWJD3/KOuU8ZUGSO6xCqNjo /91q2KsyfGds28ovnIaKkJ0BXBT1RpS9z3r2DWJFlZYQGEvJRpxL44Jee9o+z9p05W7D j5a68dklAfR4tvN2b0HFPFh5fIWmYhLZAuXi6hgsUO0KnW3x5xVIp0kRD4LFYHMC5TSp 0tcA== 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=cb2unVg/y3kPzR3lxHeExP2weV+dUFcGMy6C6nOZx0Q=; b=MALR6Kyh6XHr5F2LbWQTlm0fOrdZJ+muX8zAdwnPwOf2oNbvNpxcnkBNrSlen04CP8 T5aRQwn/G2/kdzPJNzzKZHZOI3mCIobFPBGhRg/p09POVpTauLhAQ8V9kpNQsUZH8ujg EneO5LEWuPKvFwXu5KD1fDbqfD92lvU1HEeZBLfEx19K+DpyfaQuMzkewdc5mqyGphmo T2qAYNxn1ujlkotQx5clui2Zo/+fm6SU1/5/yCsw1Q1QeajoORkCA6jI0OtboDPUjOH7 QA3Bziil8HPMIpVfR3Wea+dpVdWPXPuqJi/YPPd4JdAUghG/A2ToJukAbDmkEQkWVNEJ lTVQ== X-Gm-Message-State: ANhLgQ1xVqY7a8Eg1HiZZn9Aea0NI4mz0Xm3UOTKKumPHCQI0Dy4C6OZ LNwrVZrb8C0xApZhaj2YgOl7hb6OLyo= X-Received: by 2002:a63:ce4a:: with SMTP id r10mr1454308pgi.225.1585346641010; Fri, 27 Mar 2020 15:04:01 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:04:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 4/7] configure: Always detect -no-pie toolchain support Date: Fri, 27 Mar 2020 15:03:50 -0700 Message-Id: <20200327220353.27233-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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::441 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: dim@FreeBSD.org, Thomas Huth , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , alex.bennee@linaro.org, roger.pau@citrix.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 Reviewed-by: Alex Bennée diff --git a/configure b/configure index cbde833f6e..7ba18783cb 100755 --- a/configure +++ b/configure @@ -2107,26 +2107,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" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" From patchwork Fri Mar 27 22:03:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185024 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1824352ilr; Fri, 27 Mar 2020 15:04:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsnsrVeenKkieWAXQhg4V9ENkHUJOSueBLztDaJWE7EX5J+KdO1qFDJzdzkVWd2bHqKzK3S X-Received: by 2002:ac8:378d:: with SMTP id d13mr1496377qtc.227.1585346665531; Fri, 27 Mar 2020 15:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585346665; cv=none; d=google.com; s=arc-20160816; b=AeCHJiJkFpWLb7APBRwmcdWDCNZcN9Cepib1LuXJAQPtOSojVAo1jteDQTk/GqTKqA sWMNOZsbwGNTgcScRc/erjKSgsGxiS+bsYioRbR15ytcM6+jpxRzezxfzvT4nnflR1eY CKHbRfTkHfAOz+ON9WgfIq3YIa7YhKGqtterbbIj0czbTneBw3o1sBbvIopGIw/EhpUA s78o57UL9x4KayeXv5409mV3URz0m1iiuFK9BZTCtP5I6AuZVGMjmHEVkMTPD8XfwlYS f1CLq5aXOFTdj3fwzfnOZ2iAGgtGlYF4EOQKSzSwD/2AtmXgKcSCe0LpoWWQMrhIM/ZJ K6Xw== 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=MJ7nDsplw+ocPp9vnnkEeeJdkP45dluwjo/j6FpQjog=; b=Y1RS6VhVWMvYa8L9IJK8hxUPMj+qAw/IPbbcQQmUepI8wsTn8QeU9ZyBbhAV9R4uqA AzNfgB2ZxAXoziJx8zh/B0o5vMwbjJvFXl/qyffRX9yOP+q/4XqX0sdjNpxFgubhV/wv bVhb4eycxQ3fab4mj7JbRfOq4F8j34qTX5wll+gTJtb0WMbkRv8PJL8a7MFArDWFs441 aVCoYC25WftZSE5d/hQ35YJcm3/GjD0NVeTlUiwf2UNSesudTBGShXwlKZbiOpEm0HDv SfGjaeidyv3OTIJJMd1r2Skr5SljfU5/12tV4VpSzwHDVLP2kLQ2HZRoDwpsGh4Vf/i5 PTUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SGIZODHW; 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 d26si4185937qtc.348.2020.03.27.15.04.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:04:25 -0700 (PDT) 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=SGIZODHW; 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]:47520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx5V-0003JN-2N for patch@linaro.org; Fri, 27 Mar 2020 18:04:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49290) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx5B-0003Gs-O7 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx5A-0000iM-N5 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:05 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:38001) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx5A-0000fH-Ha for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:04 -0400 Received: by mail-pf1-x442.google.com with SMTP id c21so4494892pfo.5 for ; Fri, 27 Mar 2020 15:04:04 -0700 (PDT) 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=MJ7nDsplw+ocPp9vnnkEeeJdkP45dluwjo/j6FpQjog=; b=SGIZODHWqW/hjwO6DzDa1UhrIRnAj63GCiwop5oSfaPElIjnh+CUqjWHEpaXCoGiQa ZhGVRc/hhtLRVNRwMVttfLhDy7Mza4n9caXl3X/qBapIx4VghmIiiR8bPGbFNr+jeq2H 9NQxdo3z9v2DqCgT7Z+zjBmty7p8tc5PozFesPiA7CaVxWziiO24IrkusBqyqRy5+RJk HFLLzggNeg33XRVml6B+mL3arE6i3Tte0XHHGY+TxY0A/huu7EF5gNzf7+Ugjk2yTnuh kl/ffaNCDw2WL+9Ptcz9cOjv9tjAiZCrySPlGOWp8676r6gNd8V+VR8YUkZlOLnsVX/2 +Eaw== 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=MJ7nDsplw+ocPp9vnnkEeeJdkP45dluwjo/j6FpQjog=; b=KWRwFBJfvAqCDrnKqTox5WCnt03XJI58ggXxjIBqf1r89juTf3jcMy9G3PxcxTDqNI GY8GwyEQdA83MMTBwLJjTPa6pn+xNLWFxIiBhuuqj93IKDdzsY2JmItD8qAgZH/QvSbz Qqy1J6apn3AzeuFiwrsmkhKmvIPpwv2R/Rxexpwq/pB5KqESK0hM7waK2QXJ86uoVKyJ yq9WU8WWtVw2cVuv9ACsdSgnpZ+tHdpXfhvzruL1mRCyCXWn60DPG6U1Vg+W+gPhLSS1 Oqnfnwehos3O9i/oLuezsUrk01jmWOPuJHI8dOpfL7C9mayo8j+kiT3Olej5yj7EkPVs LcdA== X-Gm-Message-State: ANhLgQ1gc3zRLiy+c3GZciupxuodet8dTiOqzlMPX9yXO3tyGmdSihqs MTvKGc5svu3tiY4bArMXz0bog4Koo10= X-Received: by 2002:a63:a1e:: with SMTP id 30mr1455858pgk.146.1585346642695; Fri, 27 Mar 2020 15:04:02 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:04:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 5/7] configure: Unnest detection of -z, relro and -z, now Date: Fri, 27 Mar 2020 15:03:51 -0700 Message-Id: <20200327220353.27233-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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::442 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: dim@FreeBSD.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Fangrui Song , alex.bennee@linaro.org, roger.pau@citrix.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. Reviewed-by: Alex Bennée Reviewed-by: Fangrui Song Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- v2: Do not split into two tests. v3: Update to QEMU_LDFLAGS. --- configure | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 7ba18783cb..4dead416ae 100755 --- a/configure +++ b/configure @@ -2129,9 +2129,6 @@ if test "$pie" != "no" ; then QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" QEMU_LDFLAGS="-pie $QEMU_LDFLAGS" pie="yes" - if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then - QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_LDFLAGS" - fi else if test "$pie" = "yes"; then error_exit "PIE not available due to missing toolchain support" @@ -2142,6 +2139,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.plt is read-only too. +if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then + QEMU_LDFLAGS="-Wl,-z,relro -Wl,-z,now $QEMU_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 Fri Mar 27 22:03:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185030 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1832754ilr; Fri, 27 Mar 2020 15:12:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvG6wnqBUMRIatsN9Lq701Gb7909NhnB6L8bkBIRyxVhl+TK/DrXJfjw4/PV29bMsebPe9S X-Received: by 2002:a05:6214:1781:: with SMTP id ct1mr1484212qvb.87.1585347172951; Fri, 27 Mar 2020 15:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585347172; cv=none; d=google.com; s=arc-20160816; b=jg+SG2wNf5k/vSdUioFqXTiIxlGyK9C05QSjVhsH/Y7WNnQOQMJ9F3usRyeGylt2pl Zs6pIF0DJM1SFPcPazC2b+FeRgQ5taURY33UJzfEBPREk3rCaZ4FTnk3GJNmSio8s0XY jLk2F0DJmvkv9J/aMElMDnEwq5aGjihHFthw+8JXTe/IFw7RCgcehBKWL69hjrb7FPbC uH59M/jLExAXS269OsAlkAYUDrH0UUPWeAhZXHlgtUWc2nWfdC0DED4ZFNhQXRqGdBPd 0MXoDQQjI+5MZMgsCAWAOqCn2Qi3R4ydOxQ4ccXb+sRhrcQbEHWO80OQ/NdQ8TUdRee8 AvrQ== 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=tgJO+PAqo3hq/ulVfkyK+PFQv1YttMuVGSUleyX1kKY=; b=ewfyefu+7A1JyKhRFKLqzaIq7Qwq0Vc8dVBkYTZXsQNLxa0pwRWrWPj8foMAO8R+Lu tqfZpvbb88XiE45w56hrRL8zp7asm0Hb1F2Kr5TBz41aK9jeyOVK9I0BiNPbZCuIBzI5 vVdQhkBvexWKgOD/VnXVxXySpQlxN7+TVuMHT6ZnYqBhUurAXLC2YYwGHxuVXSB8YqgZ s5T6wRqzoaNgsYMOeI8NKx0B9+fHFEcVDQE5rHcrSPIaF1gIdmOh9C/qvWJM3J0FzW7h iqCv3p8pr7FYL8ypJURwTAmL9xPjGq0F3PeTJV8iH5a2Oy/db35fe9LJF5MecJ0GFTzW usZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=j1+rRHcG; 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 o20si4213574qkk.83.2020.03.27.15.12.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:12:52 -0700 (PDT) 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=j1+rRHcG; 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]:47688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHxDg-0004pZ-GO for patch@linaro.org; Fri, 27 Mar 2020 18:12:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49301) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx5C-0003Hq-FZ for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx5B-0000lO-ED for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:06 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:39209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx5B-0000iS-8i for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:05 -0400 Received: by mail-pl1-x641.google.com with SMTP id m1so3953191pll.6 for ; Fri, 27 Mar 2020 15:04:05 -0700 (PDT) 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=tgJO+PAqo3hq/ulVfkyK+PFQv1YttMuVGSUleyX1kKY=; b=j1+rRHcGn5E+TfXwHn9dOI5k/PPIjT4twOdWM7Bi5RcKw4kbudTEBZAj9cHSqQYh+P r1XUbNKGIAgIQ42pNAKN5dip/1Li2Kzj4ycffJksdk5HOiZ9bdZtOXhf/IRI7EcEXqRY tkl+qn+iGLOjPKeuFMjygLIIZQNa7/sLe9rq+86Az/xleBOZEUyTIyd92PO+vfv9GECE pcajirkSar1DYZ+TVWviQwod/nLneGkla0EFCYgPVaAQlnicgxkKzHmr3G4sYc0dAR+W F5Z1vwvc8LwaUGtAs3NF5fFfhyXSzKiDGUHzc+X+ofVWavi1LjRTY5gbzGSdOXSo8TWi tM3g== 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=tgJO+PAqo3hq/ulVfkyK+PFQv1YttMuVGSUleyX1kKY=; b=jDSNrGR/gsZ3cKZhZPs3rkSbY3jUN8NwHvr4uD3k/hrK41Wr8ZcgidZtjza/1AhwaA Zh23aX9qhOEoXwTHOkX4wxCeecsmvFYZ0GZqpox4kZk2DO7xvqoddGUJJBt8YuhnAHRW 4SkNxSoGHv5cBg9dcSkG2RvhE5f9OkJcieyEq8PoxZWCQ+VchiVUfbAUW567WItwkE3P Hq6m1Sww8BhmrQNhYfTX5Pz37NdY5CULOuerfne8JgOse4CXg3J/i67S5i+UOqQjuWVM OgisbTXqudCtjx48NDhjOJ+gbKtaAMjmkWUTEwepawMK9aFcd6NA4f7Dcr9xij0iKzcV TF/A== X-Gm-Message-State: ANhLgQ3s9ojJ3TbuanLDw8rxNowesiKxqrVcugqVgGHa93l42Uzbsd9R lvGE6Noc4rcw1nCbjTb8KLW9x2o0k4I= X-Received: by 2002:a17:90a:d103:: with SMTP id l3mr1680163pju.91.1585346643818; Fri, 27 Mar 2020 15:04:03 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:04:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 6/7] configure: Override the os default with --disable-pie Date: Fri, 27 Mar 2020 15:03:52 -0700 Message-Id: <20200327220353.27233-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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::641 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: dim@FreeBSD.org, Thomas Huth , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , alex.bennee@linaro.org, roger.pau@citrix.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: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- v3: Update for QEMU_LDFLAGS. --- configure | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 4dead416ae..b304bd0cf8 100755 --- a/configure +++ b/configure @@ -2124,19 +2124,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" - QEMU_LDFLAGS="-pie $QEMU_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" + QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS" +elif compile_prog "-fPIE -DPIE" "-pie"; then + QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" + QEMU_LDFLAGS="-pie $QEMU_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 Fri Mar 27 22:03:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185025 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp1826189ilr; Fri, 27 Mar 2020 15:06:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu3u42Jr827rUHJVFD6he3o3fpqnsGnO78OysdV8NMBVYhx+XSZKK0sjyrhnsEqc6M05wUQ X-Received: by 2002:aed:3ed0:: with SMTP id o16mr1499697qtf.3.1585346766391; Fri, 27 Mar 2020 15:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585346766; cv=none; d=google.com; s=arc-20160816; b=D/bnDQKGjo08wlr/DgFJUOZtUbjiH1ocVkY1BpnEgpl6IjV9sEJVRLmQiUJJrPsAWQ qfoSKZ5aeCjfP2N+25Xr4vszo6Q23NxpqRFXend0CWXaw7JfCazdH4RX0BHV8ec5Lba0 OoLuyBW6JOnCPygLGVNNW+10V53K2VmKBcJfSBJXOh+MxPN32LOcPLqKlr4EgKKIys3M hBaHIqJ/zZWDmgQYoGepEqjYPLK5/U/a2a+d9J2qfZL9rOr7AA02wB52LTr2nreBK7Tc rt9cBX9WS+TAAenx23Vp8iOQQMUiNxHrHXTrrbmyG0L0tkTRspWtnof5fpaPAabbYnbF hw+Q== 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=mH3MQlQn4EGVflqbnGe+eX+0IVEAf165mtEujy/8ZaU=; b=GHrFGlfX2nruh0OhtD022ifrghpW46wyRLEvbeaTmwjxS2oj0kFCwRCAK5KPyc1czM XP4y/6jfHCRbu/UdkIKIU0w6sg6FlVkYNwIbkJi4xXswf/Asua4iiDlPstC5Lr0dhhg7 a6sakovh7uBulDHNMIDNnO4/M/DIXhAIu0MfmiarwChdcMsNNG9EsQxbRDmVxRAB04pw K4n4k0GdNrpWgTpXawslejKrjcnyBlPD/R9IcIKTsEjQcEwg7+vTB8H1K0iRUhHzVhE3 5ANpCP6V6vsxIVvS8wvKHygnTjAaMZqxqSuBzrob5sTavSCdnQpruu80Hscv6YbcEmto EszQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FhfxSc4A; 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 q28si4261523qkq.284.2020.03.27.15.06.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 15:06:06 -0700 (PDT) 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=FhfxSc4A; 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]:47560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx77-0005RV-MB for patch@linaro.org; Fri, 27 Mar 2020 18:06:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49312) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx5D-0003JB-Je for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHx5C-0000qo-FK for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:07 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:41631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHx5C-0000nA-93 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 18:04:06 -0400 Received: by mail-pf1-x444.google.com with SMTP id z65so5139767pfz.8 for ; Fri, 27 Mar 2020 15:04:06 -0700 (PDT) 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=mH3MQlQn4EGVflqbnGe+eX+0IVEAf165mtEujy/8ZaU=; b=FhfxSc4Ambo3/Jk8hS6nlwoAUA3aFcFDYErO1tIkB698neIN3FSb7O1sjPkXZGHkS8 M6slEwm50IkEtLS4F0zdyC3+NNijNf5sPFxT2uHCjBt5/4BaBjq3/8FLwBQSUAbQ6XhG 9fiQ/AC4uEIUFt2w5nvbFJyYwdT06zkk2ua3yE38n5HFD61LScVtn+G6xh8UQLi5c7mQ GZDCBHYWyQkDgj1p6g12M5N4cYcoq8uvmzP2ba5STi3ed9Z4IAddcMbsyWaX2qfFwgAR AeB3XODOlhrqPfNdL6DW/kbV2k3QRdUvDjl0v+XtOwerfMKTZ1RbKLSzlFqY1YM/P0ER 7muw== 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=mH3MQlQn4EGVflqbnGe+eX+0IVEAf165mtEujy/8ZaU=; b=ehFJUQhw8g3Owj7fYu1bldXzV6XspVyATOhRwFGoZQWiQK8he2ebDqAaFKLyTTz8XL gxIBpI9grV7EuFSUPQ8xhpLHUeEKdDklk5TaFvDFCV7lQlufDIdaj6ieGDwcoXsyb3Cf aVDHL+OAvv7vcnKoAqdtV3HotBxQOakxV4bn7o8KjA71xIwIhEBCPlONUDyDQxf1b/Bk IeHJLRZk6fjHSxYQIkLHRo5qh9KCOUBdrDl7U+ghRWzM1O/5cdqbyaJ+FCvkNOrB6K8L JIF+2yNxrNtGtXi1QJc3LSH+vQ61+gkOJG98/S4vaC0bclcAPdMiqtHUtjYFOd5zNY3l BHkg== X-Gm-Message-State: ANhLgQ189Wd6lgNLj6ez0NjN1TyVGJKiVBEMxSf0db9h4LSHygU0azvj C78IFVv37BYcjFgd/KYq3N63vYqToFI= X-Received: by 2002:a63:6fc6:: with SMTP id k189mr1396085pgc.175.1585346644986; Fri, 27 Mar 2020 15:04:04 -0700 (PDT) Received: from localhost.localdomain (174-21-138-234.tukw.qwest.net. [174.21.138.234]) by smtp.gmail.com with ESMTPSA id y29sm4516929pge.22.2020.03.27.15.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 15:04:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.0 v3 7/7] configure: Support -static-pie if requested Date: Fri, 27 Mar 2020 15:03:53 -0700 Message-Id: <20200327220353.27233-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327220353.27233-1-richard.henderson@linaro.org> References: <20200327220353.27233-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::444 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: dim@FreeBSD.org, alex.bennee@linaro.org, roger.pau@citrix.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. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- v2: Fix --disable-pie --static v3: Update for QEMU_LDFLAGS. --- configure | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/configure b/configure index b304bd0cf8..a16ae9a2be 100755 --- a/configure +++ b/configure @@ -1067,7 +1067,6 @@ for opt do ;; --static) static="yes" - QEMU_LDFLAGS="-static $QEMU_LDFLAGS" QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" ;; --mandir=*) mandir="$optarg" @@ -2089,11 +2088,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 @@ -2124,7 +2118,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" + QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS" + pie="yes" + elif test "$pie" = "yes"; then + error_exit "-static-pie not available due to missing toolchain support" + else + QEMU_LDFLAGS="-static $QEMU_LDFLAGS" + pie="no" + fi +elif test "$pie" = "no"; then QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS" QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS" elif compile_prog "-fPIE -DPIE" "-pie"; then