From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by sourceware.org (Postfix) with ESMTPS id C806B385702F for ; Tue, 7 Jun 2022 20:15:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C806B385702F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id h5so25667638wrb.0 for ; Tue, 07 Jun 2022 13:15:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:references:in-reply-to :content-transfer-encoding; bh=Ycp5j0oU57t6ZjwIElQ/heXAoxTK76xLCAzLNvnd0sU=; b=g66CnOUHgr59vqm3RicjpJAMvi02/Td5OL7V3tX5eWCAkbiLCMcOdZdOGHE3vB5wO6 jY0ZYun6pfDp6AC3j5Zmiye92IauYPlwtLIN/b3gzXG07TM06Bd6eh+Z1CnaLj1rIP3Q zaCzEFkY0SrYT+YfanZF3q6zI0sefhnpAfuFYntnDyc+MEQXs2tHAJiyIVxJ56vEm249 aarh9ajflAGrXA5KJelgfLmvv/rRWlgBmXTCegx4wS8EpaFwnTdg1duk2QqIXuERgxI2 2gpxuBq2jB+12zKRhiuThYUsjrrlTLXe5gbjfQJzpbktDgDwC7y8K9HWU70Y53GUlfur ugXA== X-Gm-Message-State: AOAM530CVSHvaSobiLaQlacPWHO0j7lDWdLnHedd4MeP9NqWHyyCc1gJ 0ZkdlTDu1oaT1gEaWvk4agQ= X-Google-Smtp-Source: ABdhPJx+kkOezogIU+bFt3rNCK3LQ1dZ2fbq60Sv1Um7GCLKNS86PYsj769CLrf/desOGTWTqzdFxg== X-Received: by 2002:a05:6000:15ca:b0:218:48a7:a45f with SMTP id y10-20020a05600015ca00b0021848a7a45fmr9401832wry.591.1654632915635; Tue, 07 Jun 2022 13:15:15 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id x8-20020adff0c8000000b00210a6bd8019sm18465817wro.8.2022.06.07.13.15.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 13:15:14 -0700 (PDT) Message-ID: Date: Tue, 7 Jun 2022 21:15:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 5/5] gdb: native target invalid architecture detection Content-Language: en-US From: Pedro Alves To: Luis Machado , Andrew Burgess , John Baldwin , 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> In-Reply-To: <5c316bab-c2d3-309e-f938-7480e861b444@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: Tue, 07 Jun 2022 20:15:18 -0000 On 2022-06-07 19:42, Pedro Alves wrote: > When we use gcc for arm-linux target, its file name can be different, > arm-linux-gnueabihf-gcc, arm-linux-gnueabi-gcc, or arm-none-linux-gnueabi-gcc, > so I add a variable ARM_CC_FOR_TARGET, so that user can set the name > of gcc for arm-linux target on aarch64, like: ... > Maybe it would be possible to come up with a way to default ARM_CC_FOR_TARGET to > something that works for most people when testing aarch64, somehow. Maybe something like this? Completely untested, other than hacking it such that the aarch64 linux path is taken on my x86-64 box, to ensure the tcl at least parses as expected. I left arm-linux-gnueabihf-gcc last on the theory that binaries produced by arm-linux-gnueabi-gcc and arm-none-linux-gnueabi-gcc would run everywhere, but arm-linux-gnueabihf-gcc might now. I am not really sure about that, I may be making that up. gdb.multi/multi-arch-exec.exp also uses ARM_CC_FOR_TARGET. If something like this works, then we could do the same to that testcase. Even better if we manage to factor this out to a shared procedure used by both testcases. >From 56cdd32a54b236d35c433809fcb015f20487dc4b Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 7 Jun 2022 20:11:32 +0100 Subject: [PATCH] aarch64: gdb.multi/multi-arch.exp: Add fallback if ARM_CC_FOR_TARGET not set On Aarch64, you can set ARM_CC_FOR_TARGET to the 32-bit compiler to use when testing gdb.multi/multi-arch.exp. If you set it, then the testcase doesn't run. I guess that approximately nobody remembers to set ARM_CC_FOR_TARGET. 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. Change-Id: Iefe5865d5fc84b4032eaff7f4c5c61582bf75c39 --- gdb/testsuite/gdb.multi/multi-arch.exp | 39 ++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp index e5c2d9cc161..a9d442d89ad 100644 --- a/gdb/testsuite/gdb.multi/multi-arch.exp +++ b/gdb/testsuite/gdb.multi/multi-arch.exp @@ -61,18 +61,47 @@ set options [list debug] if [istarget "aarch64*-*-*"] { if {[info exists ARM_CC_FOR_TARGET]} { - lappend options "compiler=${ARM_CC_FOR_TARGET}" + set compilers [list ${ARM_CC_FOR_TARGET}] + } elseif [istarget "*-linux*-*"] { + # Try a few common compiler names. + set compilers { + arm-linux-gnueabi-gcc + arm-none-linux-gnueabi-gcc + arm-linux-gnueabihf-gcc + } } else { + set compilers {} + } + + set ok 0 + foreach compiler $compilers { + set arm_options $options + lappend arm_options "compiler=$compiler" + + if {![is_remote host] && [which $compiler] == 0} { + # Avoid "default_target_compile: Can't find + # $compiler." warning issued from gdb_compile. + continue + } + + if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" ${exec2} \ + executable $arm_options] == "" } { + set ok 1 + break + } + } + + if {!$ok} { unsupported "ARM compiler is not known" return -1 } } else { lappend options "additional_flags=${march2}" -} -if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \ - $options]} { - return -1 + if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \ + $options]} { + return -1 + } } # Start inferior 1 base-commit: 0c8cd1de90b97f12b27b40c2922a03a68932eea1 -- 2.36.0