From patchwork Fri Jan 12 12:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 187726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp149275dyc; Fri, 12 Jan 2024 04:52:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9m2ly5hF6g+CUC9JKHG39ypE/Zg7XIiekpujVJcpD+vd/ssHvU2hEkEANOJ0lyh2+lrrH X-Received: by 2002:ae9:e00e:0:b0:783:2b08:b1e4 with SMTP id m14-20020ae9e00e000000b007832b08b1e4mr1357569qkk.70.1705063941985; Fri, 12 Jan 2024 04:52:21 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1705063941; cv=pass; d=google.com; s=arc-20160816; b=eI5uwSnytNRc5r5zHlUU0b4npLqyoD4PGxUZP6jTAOxsNnC1+5ADMqtq3cL8W7zhZE ywVib86UGikCOIdS8Tm6HJnpaJiqhQ6waeqPfcVPMsfH3s2ZCCJd3DEO43p+OaSuX+y6 jdbvt2rHrbyLq1za7YGlWTPqL73maRBfPxNB5CWsQXc6jCrVsxvfNC2b9bImBzNrnx1V WELcXtju/iqlxCHzlAhej2bngzxO+C9kYsFNgKuGGxMQFCfkQjHdGIR6vShM1RJAfEBS P7+/rTibG4biog3YE4NMqzc5pSZbkW8iRXRXlY/OtZ0I6UU9/VfBRwRtJ6VcVLWK1xJc 2Kkg== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :subject:to:from:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=bwiXWfR9XuY7PO12pGN46xCrq0V2sDITXC/C1YGFldA=; fh=pWdLyvNb+I1vVBXs4KtLops0oPhAUdW1QRfYuCnnNPM=; b=q3DP5s9Mv8wRuR5bWNxSXYIZBfPQToDaLRYfXsav3w9XJeCQ3atkupwG6gPfJ7/8Bo P/TPLa4n+2PX5GCNYqEVavUKus8dRhvCejlcHqzWYdzOmfwhGbJ6Eb/kgGrGXlXHXMdB 2D4lQ73yQsUx2Bk4ylw9D1p0yPgry7R/fZtL5ANBJcvvrtsf8sG/5VkBCOsaC+6ntFzP pGLr9JKqkdxHZmEimb+STae0188hQ84OCcaaVppk4E0dNjqzzmuZmJYMTLRHZ5Imm+vA LIvdI+gUrIGdxryuvZMgsjzybTkhigzrlto+rvLeUnc1gA/dGW8+XBlNLqsZV0VMeeHi zGpQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@gjlay.de header.s=strato-dkim-0002 header.b=GZ25GYje; dkim=neutral (no key) header.i=@gjlay.de header.s=strato-dkim-0003; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c2-20020a05620a0ce200b007814967b933si2773106qkj.710.2024.01.12.04.52.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 04:52:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gjlay.de header.s=strato-dkim-0002 header.b=GZ25GYje; dkim=neutral (no key) header.i=@gjlay.de header.s=strato-dkim-0003; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A74D03858003 for ; Fri, 12 Jan 2024 12:52:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.162]) by sourceware.org (Postfix) with ESMTPS id 8FDF13858D37 for ; Fri, 12 Jan 2024 12:51:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FDF13858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gjlay.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gjlay.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8FDF13858D37 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.162 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705063905; cv=pass; b=kr0ryIurPc2luyZcSIGUoF606EXI2ETTEeGo2W6A/61qBF0+xxbtD6Z1GA1Svr733wxCAoeMTHH3/z9cEgzdfQXaYeQGhGv8sNxBfRlVa4zVo9hgzJE+PZu7wxjOUzWdVKT39hcnkdJNmXfU0nbzlIrkT5YPdMeVss4gUm1e+4w= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705063905; c=relaxed/simple; bh=gFGtcc8iySkMYNCErXHtffldRvqVxzz9Z+ZfH8odEyQ=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=Lb+OdUry7xQU/cC+zEaZsT7LpAQFJPVpZDRIEydE8nhjYFkNMzk5diAOk/7wXjU6eedcXTPddisN730F0R5lKr3HK3bvSFS7IRSmmjm7gBm83bEhGlhWvm2Cz2ZRQ7g2gZVQlyrB+ahdGAMEdb7YTIAej1rMZdpSgTf1gb8orG8= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1705063901; cv=none; d=strato.com; s=strato-dkim-0002; b=Crej3JEPnOWRxCr6bV+WtbRFCE5FyLnKEsb/sDDgAK41Y7ynVtm0F5n7sS628iD8sk OdX0D4DIHRHXeX4vjRRkAheaHGnQ784v3mAq5H1mSSHmJ6X+G/Dn2KNMtZjUJqlTTmRD k+OtdvkrhAAG2oBwMhHpA0u1+72UdTS9jYpVqxppNJTiG6R9ecp49O/wNpOF98mEv4mV HcLn6jhWEj3nleT8aQswBd+H34RE+kGXuTprjhhwiaXKAVXYKoTqH6aT3Q45aylseBhD rymDbIC0pw6poLZsSNtQuMdGnYokd1ZrsF0UVPrc+FFtuivjIRMwjPasCfN7FNB8kyYF tcQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1705063901; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=bwiXWfR9XuY7PO12pGN46xCrq0V2sDITXC/C1YGFldA=; b=aG9KoSCftYioBcdM7AQdl2yPSeZC5GR2FkPUFwdohVq/Sa6Qf2I5VVS2t5S+R55SjG 7jDbcw4WwMAZ+A5AyNDfb2ahQ/mRwl0Cak/Eyn4C9nEZKdsI4XBMUoWJB/ln6tFxNGsf vTf61+As4kIoPKFKGKtQ1mDXx+9riaDPxbD/BqHG1aFmqlp9sdX+O+Glk2eFfnkcUagp 8t1NjCOSsBiDR2CIflr/1JWjCTQWk3WZekuqU5uPKsBExW955GRiWHAfvN2OfoD++JhV 6O8RVSd3fE33bsGMQw1JsxbqAk59whqHK62XRtpATa1IaQK24QQNUmjWbNwgj8suaGbp p53w== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1705063901; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=bwiXWfR9XuY7PO12pGN46xCrq0V2sDITXC/C1YGFldA=; b=GZ25GYjeLe7MJLlXtOfdgOp/vhs8jF8IFtw7V/PEojzlIhteoYhvTmFqQaqJx67M3s +QQRCUmuTJ8hPkUJ5t8t7VDULOS8OfRfP4KgXa3sXr0xfNUX7NjnxNpqacVSo+JvKzna x7DZRi5cOeQ1mWZSYkGZh763/w+FlHfWJsHm+mBN6Pl8kwKPEc8ArHnaZf2Hk4e3k2Of Q32nZj8DWm46QFiLUGfNuielrVTwTFTS+9YRhC4O0I7vmljS6Gvf52fWCYCAVZs0tdQB sp8+TKaAafinSzDArax+paA08jGnF2zvE9LTFPNa0tD8KOmid4NQokypOu+8XRP4db/X Ykgg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1705063901; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=bwiXWfR9XuY7PO12pGN46xCrq0V2sDITXC/C1YGFldA=; b=cCvZb6uZvTDKqp5X7jspfRirB/d9stNAHuwigt+c+kwZMOim8Mb922dTNlfu1CKdox BLYEq2KktZzjsfZO89Bg== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkSjsSjq3WhKPVxx3mY" Received: from [192.168.2.102] by smtp.strato.de (RZmta 49.10.2 DYNA|AUTH) with ESMTPSA id g5de8600CCpfPNe (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 12 Jan 2024 13:51:41 +0100 (CET) Message-ID: <238c0c70-5c89-483f-9387-1c6f1b4db6b2@gjlay.de> Date: Fri, 12 Jan 2024 13:51:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Georg-Johann Lay To: gcc-patches@gcc.gnu.org, Denis Chertykov Subject: [patch,avr,applied] Fix PR107201 -nodevicelib not working for all devices. X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787889127971475385 X-GMAIL-MSGID: 1787889127971475385 Since the advent of devices AVR*, the spec pattern mmcu=avr* does no more work to discriminate between devices and cores like avr51. This means -nodevicelib no more works for AVR* devices because that option is removed for mmcu=avr* (which were only cores in the old days). Instead of that pattern, a new spec function is used. When there are no objections or improvements within the next week or so, I'd install the patch below. Johann --- AVR: target/107201: Make -nodevicelib work for all devices. The driver-avr.cc contains a spec that discriminates between cores and devices by means of a mmcu=avr* spec pattern. This does not work for new devices like AVR128* which also start with mmcu=avr like all cores do. The patch uses a new spec function in order to tell apart cores from devices. gcc/ PR target/107201 * config/avr/avr.h (EXTRA_SPEC_FUNCTIONS): Add no-devlib, avr_no_devlib. * config/avr/driver-avr.cc (avr_no_devlib): New function. (avr_devicespecs_file): Use it to remove -nodevicelib from the options for cores only. * config/avr/avr-arch.h (avr_get_parch): New prototype. * config/avr/avr-devices.cc (avr_get_parch): New function. diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h index 03b3263d529..0ee335038a4 100644 --- a/gcc/config/avr/avr-arch.h +++ b/gcc/config/avr/avr-arch.h @@ -195,6 +195,7 @@ typedef struct extern const avr_arch_t avr_arch_types[]; extern const avr_arch_t *avr_arch; +extern const avr_arch_t *avr_get_parch (const char *mcu); extern const avr_mcu_t avr_mcu_types[]; diff --git a/gcc/config/avr/avr-devices.cc b/gcc/config/avr/avr-devices.cc index 90846f3da21..43d38eb3916 100644 --- a/gcc/config/avr/avr-devices.cc +++ b/gcc/config/avr/avr-devices.cc @@ -153,4 +153,20 @@ avr_inform_core_architectures (void) free (archs); } + +/* When MCU names a core arch like "avr5", then return a pointer to the + respective entry in avr_arch_types[]. Otherwise, return NULL. */ + +const avr_arch_t * +avr_get_parch (const char *mcu) +{ + for (size_t i = 0; i < ARRAY_SIZE (avr_arch_types); ++i) + { + if (strcmp (mcu, avr_arch_types[i].name) == 0) + return & avr_arch_types[i]; + } + + return NULL; +} + #endif // IN_GEN_AVR_MMCU_TEXI diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 3ef60b9ab7f..7f7e23183b2 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -500,9 +500,11 @@ typedef struct avr_args extern const char *avr_devicespecs_file (int, const char**); extern const char *avr_double_lib (int, const char**); +extern const char *avr_no_devlib (int, const char**); #define EXTRA_SPEC_FUNCTIONS \ { "double-lib", avr_double_lib }, \ + { "no-devlib", avr_no_devlib }, \ { "device-specs-file", avr_devicespecs_file }, /* Driver self specs has lmited functionality w.r.t. '%s' for dynamic specs. diff --git a/gcc/config/avr/driver-avr.cc b/gcc/config/avr/driver-avr.cc index 2512c2c546a..b44136e2577 100644 --- a/gcc/config/avr/driver-avr.cc +++ b/gcc/config/avr/driver-avr.cc @@ -105,7 +105,12 @@ avr_devicespecs_file (int argc, const char **argv) return concat ("%{!nodevicespecs:-specs=device-specs", dir_separator_str, "specs-", mmcu, "%s} %