From patchwork Wed Feb 12 13:56:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 37992 Received: (qmail 109778 invoked by alias); 12 Feb 2020 13:56:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 109754 invoked by uid 89); 12 Feb 2020 13:56:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2020 13:56:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581515786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V5RcYNDSJmYu2j5NOWYkc9bU6nDW2n0Cck3LUCqLki4=; b=FzeqP40uyvaLJtgCpPJlqFZQjTIFFm+n2VZLViIRiUoP6N8CcQO6e40wZEE+8fAlz+Rvf0 yCukkl3rykHa34thwuPIUlR3SA+T4EWwaQmVE3d0yGktl1YE1/zNjbxcM2xEmrwkOFuAeN 9kD+5/4OsoK00puzPvefEYNTXcshdSA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-77-3XUqfvEANjK1DFOP_5Qf0g-1; Wed, 12 Feb 2020 08:56:20 -0500 Received: by mail-wr1-f69.google.com with SMTP id p8so847319wrw.5 for ; Wed, 12 Feb 2020 05:56:20 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id s8sm758525wrt.57.2020.02.12.05.56.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 05:56:16 -0800 (PST) Subject: Re: [PATCH] configure: Re-disable building cross-gdbserver To: "Maciej W. Rozycki" , Tom Tromey References: <87a75p9mg9.fsf@tromey.com> Cc: "gcc-patches@gcc.gnu.org" , "gdb-patches@sourceware.org" , "binutils@sourceware.org" From: Pedro Alves Message-ID: <23ccb2bf-7e7a-3896-cc87-fd5398a158ca@redhat.com> Date: Wed, 12 Feb 2020 13:56:15 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com On 2/11/20 9:01 PM, Maciej W. Rozycki wrote: > On Tue, 11 Feb 2020, Tom Tromey wrote: > >> Maciej> Correct fallout from commit 919adfe84092 ("Move gdbserver to top level") >> Maciej> and revert to not building `gdbserver' in a cross-configuration, that is >> Maciej> where host != target, matching the documented behaviour. We have no way >> Maciej> to support non-native `gdbserver', and native `gdbserver' is usually of >> Maciej> no use with cross-GDB of the chosen host. >> >> Pedro had a different way to do this, that keeps the decision under >> gdbserver's control: >> >> https://sourceware.org/ml/gdb-patches/2020-02/msg00383.html > > That's actually quite similar to what I considered first, before I > changed my mind. Whatever. Doing it in gdbserver/ has the advantage that it stays under gdbserver's control, so it doesn't need syncing code with the gcc tree. I know of at least one off-tree port that uses gdbserver in a host != target scenario, so I imagine that this condition will evolve over time. Also, this way, changes in this area don't require running autoconf to regenerate configure. I'm not seeing any downside. > > However I would expect `exit' not to be what we want in a sourced script > (I did this differently; see below). Good point, somehow did not think of that. It worked in my patch because we source the script in a sub-shell. But it's clearer/better to not rely on that. > > case "${host}" in > + ${target}) > + gdbserver_host=${host} > + ;; > + *) > + gdbserver_host=NONE > + ;; if/else reads more to-the-point to me, so I tweaked it that way, and merged it in (to binutils-gdb), like below. I'm sorry for not noticing your earlier patch. From f20e3e823d56e54ffe56792ea6a2fe947c2dec0d Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Wed, 12 Feb 2020 13:50:30 +0000 Subject: [PATCH] Disable gdbserver on host != target configurations Correct fallout from commit 919adfe84092 ("Move gdbserver to top level") and revert to not building `gdbserver' in a cross-configuration, that is where host != target, matching the documented behaviour. We have no way to support non-native `gdbserver', and native `gdbserver' is usually of no use with cross-GDB of the chosen host. gdbserver/ChangeLog: 2020-02-12 Maciej W. Rozycki Pedro Alves Skip building gdbserver in a cross-configuration. * configure.srv: Set $gdbserver_host depending on whether $target is $host. Use $gdbserver_host instead of $host. --- gdbserver/ChangeLog | 7 +++++++ gdbserver/configure.srv | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) base-commit: 38de8abe21fe17c31888094bd860a84f88cb5749 diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 09707067730..709ef23674c 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2020-02-12 Maciej W. Rozycki + Pedro Alves + + Skip building gdbserver in a cross-configuration. + * configure.srv: Set $gdbserver_host depending on whether $target + is $host. Use $gdbserver_host instead of $host. + 2020-02-11 Simon Marchi * configure: Re-generate. diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index 2e83cbdc07f..375ac0aeb2a 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -33,9 +33,16 @@ ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l- # these files over and over again. srv_linux_obj="linux-low.o nat/linux-osdata.o nat/linux-procfs.o nat/linux-ptrace.o nat/linux-waitpid.o nat/linux-personality.o nat/linux-namespaces.o fork-child.o nat/fork-inferior.o" -# Input is taken from the "${host}" variable. +# Input is taken from the "${host}" and "${target}" variables. -case "${host}" in +# GDBserver can only debug native programs. +if test "${target}" = "${host}"; then + gdbserver_host=${host} +else + gdbserver_host= +fi + +case "${gdbserver_host}" in aarch64*-*-linux*) srv_tgtobj="linux-aarch64-low.o" srv_tgtobj="$srv_tgtobj nat/aarch64-linux-hw-point.o" srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"