From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id 30431385276B for ; Thu, 9 Jun 2022 16:31:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30431385276B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id B86C07FC50; Thu, 9 Jun 2022 16:31:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LJqNn4JM3z4Z4S; Thu, 9 Jun 2022 16:31:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654792297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EyBjjcabw6cSJV1ZsalHJHhNozfrMYzSYWqjWZ7yTas=; b=vhPn4vJfu+oPGmpYst7ZW9gPli1vChuYWHMvIBC35Tv1NStLNlUvfOo1egDoKNPOTWNY/R jjD4YhqCnE44a4vY/bJokCWxhe1Gbb94NSCdGASdS1iADWEsXprNExz8LLIUc4UMETANze qXR9xGCVpzkF404HcmJZ5WgSmrCp6i/gjt3RmjtQGn73aqRDXXOZykmzAVBNFEMMUe8SSt ACdq3CIlUjEtqPylv46HtNbl/rS1advDjCe8sSIY9IrlbCa6wbbx9XnKKTTo4pMNpCczvY TDZStgUGfVutx5rw/Ne8DPTeGXf6YMA2VbiDs335ZWHyWHCx9WfDFBcnJbsjCg== Received: from [IPV6:2601:648:8680:ed60:99d0:1b32:8e6e:2ffa] (unknown [IPv6:2601:648:8680:ed60:99d0:1b32:8e6e:2ffa]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 7E70821EE1; Thu, 9 Jun 2022 16:31:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Thu, 9 Jun 2022 09:31:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: Pedro Alves , Luis Machado , Andrew Burgess , gdb-patches@sourceware.org References: <71a986a5-2cfa-543e-4034-70f3af7dfecf@FreeBSD.org> <87ee09d4rt.fsf@redhat.com> <09afe250-9573-45e1-993b-a2f911f03630@arm.com> <87ilpdhn73.fsf@redhat.com> <87ee01hed4.fsf@redhat.com> <12c3913e-186d-b676-fe52-cc3322b00926@arm.com> <5c316bab-c2d3-309e-f938-7480e861b444@palves.net> <9c711ccb-a558-8225-524b-5a1fa93fcee9@arm.com> <22be6164-79d7-c0f7-1b1b-c633be452e81@palves.net> <755636d3-b2b5-9eeb-1b23-6f9830e3edbb@palves.net> <5528f112-1674-0f37-7a80-a77db8d1a31c@FreeBSD.org> From: John Baldwin Subject: Re: [PATCH v2] aarch64: Add fallback if ARM_CC_FOR_TARGET not set (was: Re: [PATCH 5/5] gdb: native target invalid architecture detection) In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654792297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EyBjjcabw6cSJV1ZsalHJHhNozfrMYzSYWqjWZ7yTas=; b=P22n7jCcu1WeYniBVB2VQTZhvWahxlwEcmuHgNIQ7L2krWwy2IA9hwaGRPmP5st0gDevlc luUZSkZmMIkunLbCkVaP6MkOx5+oCfPWKC5eGyEX8UdedJGYk0JwN1J1qCHFMrBcHQzdt+ SOlJE9EISgzucCIZ8ctViZGJT72h8oliS8/tspNLpIBMJhrtQACPbA/+GzVag+NaPoGina mrHYIUro2qKl4cSuUTkzIyPShlDuwDuF0FL2SKaeasH4rGPq4QE/cKzopHBYZw04/0v3v6 In1b+4yikfsgLqALgJXvB5b6NxVi44LY0N6+b4a1Kw1MC+wtMGZ763VKVwC/Xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654792297; a=rsa-sha256; cv=none; b=nUrrbFAbtgKGWD/3Rlo/MMmk2RCpopI/aqay7yrOeQYALoSbuUbpjWV51kaNJPFf/egB58 szmojSYUW0Iuy6ws9sN+zwGs5+CgJuBzOT3DllAsXwMpOiRurdxh/ctv0XVPLktmrSrGCK wkhILvbBcu6GjgG/6QXVJjzH32+1jYRw3314RlvpUpARopSYbI131P1TRsGCbxN1BJsJsd 1M6s/5aNTGkLFHmCQNltTtYHHxs8xivUmSMaBb1krOi4u7WVKgGmGY5J7myPbM+L0Zr7Yb M36yHY/8m6YfiNUgjgDS7ssBA8MKl1il9yH5lExVoGR54Qu52WgAE0pZXvXyZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2022 16:31:40 -0000 On 6/8/22 2:48 PM, Pedro Alves wrote: > On 2022-06-08 20:01, John Baldwin wrote: > >>> This commit adds a fallback.  If ARM_CC_FOR_TARGET is not set, and >>> testing for Linux, try arm-linux-gnueabi-gcc, >>> arm-none-linux-gnueabi-gcc, arm-linux-gnueabihf-gcc as 32-bit >>> compilers, making sure that the produced executable runs on the target >>> machine before claiming that the compiler produces useful executables. >> >> Note that if the target compiler is clang, it will probably already >> support 32-bit ARM via a -target option.  Not sure if you want to try >> to handle that case here as well? > > Sure, why not. > > Do these multi-arch tests work on FreeBSD? At least gdb.multi/multi-arch.exp should, > since FreeBSD supports multi-process nowadays, right? Yes-ish. There are some failures that are probably bugs in the FreeBSD native target (or ptrace behavior with now signal catching works on FreeBSD that breaks some test assumptions). >> The other wrinkle perhaps is that just because you have a capable >> compiler around may not mean that you have 32-bit libraries available >> to link against?  I'm not sure if the compilers you list in your patch >> ensure that you have an ARM libc around as well via dependencies. >> > > That is exactly the same as on x86-64. Just because you have gcc installed, > which can compile 32-bit x86 with "gcc -m32", it doesn't mean you have the 32-bit > runtime libs installed. So any test using -m32 today may run into that issue already. > > However, note the new arm_cc_for_target proc compiles/links AND tries to run the resulting > program. If there's some basic 32-bit runtime dependency missing, then the probing > program won't run successfully, and we'll try the next compiler in the list of potential > compilers. If we run out of compilers, then the proc returns "" and the testcase that calls > arm_cc_for_target ends up bailing out with UNSUPPORTED, like so: > > . if {[arm_cc_for_target] != ""} { > lappend options "compiler=[arm_cc_for_target]" > } else { > unsupported "ARM compiler is not known" > return -1 > } > > On the aarch64 ubuntu 18.04 machine on the compile farm, the first probed compiler > (arm-linux-gnueabi-gcc) compiles&links successfully, but then running the built probe > program fails. The second alternative doesn't exist on the system (arm-none-linux-gnueabi-gcc), > so it's skipped, and then the last alternative (arm-linux-gnueabihf-gcc) compiles&links&runs > the probe program successfully, so that's then the compiler that is used by the actual testcases. Ok, that works great then. Right now FreeBSD doesn't build and ship 32-bit libraries for aarch64 by default. If that changes in the future I will take a stab at updating this function to support clang by trying to use -target if the current CC is already clang. -- John Baldwin