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: 1263063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=kCDtsAJo; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pwst4CXTz9sSG for ; Sat, 28 Mar 2020 09:06:10 +1100 (AEDT) Received: from localhost ([::1]:47552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx7A-0005FP-Hk for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:06:08 -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-Google-Smtp-Source: ADFU+vuT//rKPg2fu0uEwd2siuQkQo34heKGqlxAc4SGr5vNfHiOKmcRFVEUuMfXhpB+3qDnsrRjLg== 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+incoming=patchwork.ozlabs.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(-) 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: 1263065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=TywaZMPB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pwv71y1Gz9sSG for ; Sat, 28 Mar 2020 09:07:15 +1100 (AEDT) Received: from localhost ([::1]:47576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx8D-0006xQ-5D for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:07:13 -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-Google-Smtp-Source: ADFU+vt1BaMX3C12VyD+uTFPajirso7jSCoEdnN1WgNIxypn00i9s7+3r2eygsJaV1QCfCRZtuiO2g== 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+incoming=patchwork.ozlabs.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(-) 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: 1263066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=eBqtBNxX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pwxG4KNBz9sSG for ; Sat, 28 Mar 2020 09:09:06 +1100 (AEDT) Received: from localhost ([::1]:47594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHxA0-0008Mx-Ih for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:09:04 -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-Google-Smtp-Source: ADFU+vuaKMGLCUG9eAji94bRLpnr6cXWut+tpvChaOmAG8/WFA2zK1CHAeRU8SwP4AGfjaubWX6Ejg== 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+incoming=patchwork.ozlabs.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(-) 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: 1263067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=rciY0xXw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pwyg518Hz9sSG for ; Sat, 28 Mar 2020 09:10:19 +1100 (AEDT) Received: from localhost ([::1]:47616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHxBB-0001CM-JX for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:10:17 -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-Google-Smtp-Source: ADFU+vtnfthVRC5SDRUhSJTimH+HZybzPs0huqnZlv+n7XxLWr03WbbQl4DpVw0xoKLgXykTP6uXyg== 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+incoming=patchwork.ozlabs.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 Reviewed-by: Alex Bennée --- configure | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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: 1263062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=SGIZODHW; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pwr60qXhz9sSG for ; Sat, 28 Mar 2020 09:04:38 +1100 (AEDT) Received: from localhost ([::1]:47520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx5g-0003JN-0A for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:04:36 -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-Google-Smtp-Source: ADFU+vviO2tLdpvUxMHpTYrsfu9O5Btp0841gan6FWzX7aYZhZWtLf9ryzOAUP5ksHKvwJ0PiGOo7w== 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+incoming=patchwork.ozlabs.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(-) 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: 1263068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=j1+rRHcG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48px05599Nz9sSG for ; Sat, 28 Mar 2020 09:11:33 +1100 (AEDT) Received: from localhost ([::1]:47658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHxCN-0002om-Ll for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:11:31 -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-Google-Smtp-Source: ADFU+vstRWahSsEbMTfrxMdaoylQ1cLvjKhh5jogzPB0sNf4FHy2i4t6cVNlfhl3UedNEV4pV0L36A== 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+incoming=patchwork.ozlabs.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(-) 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: 1263064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=FhfxSc4A; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pwt10384z9sSJ for ; Sat, 28 Mar 2020 09:06:17 +1100 (AEDT) Received: from localhost ([::1]:47560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHx7G-0005RV-T4 for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2020 18:06:14 -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-Google-Smtp-Source: ADFU+vt42ukDlhBH76ag8n+5qZL6OrYHr3VjtA76CSYQgVp5+O1G8nqj5zacLhI+jXgej7/drbbtAA== 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+incoming=patchwork.ozlabs.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(-) 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