From patchwork Thu Jan 18 09:16:07 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: 84329 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF7FE3858417 for ; Thu, 18 Jan 2024 09:16:53 +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.221]) by sourceware.org (Postfix) with ESMTPS id 8E8443858CDB for ; Thu, 18 Jan 2024 09:16:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E8443858CDB 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 8E8443858CDB Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.221 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705569371; cv=pass; b=CPcDh6TI4JGfSno/eXpd1TjeL4zVLk8iicVyYULGB4EvQdyKF3I8wZBZfGpjFxLIoj36wG7y0s4lCzRjLPaNZoNrYlCgk18dfrpDtf0kLdA+TvtKYiWDO8LPsgAJY/F+XEJzV4I3ncU/raaJGHkvVTuTV4Vt2RimTsGcaELLMjY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705569371; c=relaxed/simple; bh=ny10KL0FRg3c8pEZTi/mYQWxjXnsDs9E+2T5jRZhk5M=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=FCTBt8dgh6JCQ3cZ871A5rQx7Gwu/aBxtngEa3B6FD+RrseT6LA+ha2KSIlhp+Zt593YMtVQVwfZD/GAPMgnXRY4tgK4SdxPG+8wvHHQj9xiF3c7A6jYkbvM9MpROnlh+wukeDutUADhCoCDV4eul99p+2GCVa2SD3SDR/XDpuc= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1705569367; cv=none; d=strato.com; s=strato-dkim-0002; b=bbeS+1Cymcnj2g4YjokFJThuEJZ4Jsu6ZRxILBiV3l+EzscTBj6QDTLbWhL9B8PTFj cYwNbqtC00HntsIcGUaqweTqC6t9gkoKyVdZgDCJho9Qxp2OP1nWuthiYqtAp7Y2/Le3 +a1Py8nDDRF/Xi90hpAfL1RdmuH4Aj1Rc+Y2ogsIeJI4MM6rpRW/D2vcVhVii0l82uBd etx1H2ibxjFXwoQdmOLfIyHEt+LsIdkK0HxAr0jLnsy1HeN2bAszLhIGgATBmR0L/ij8 iOxJUxoCsCcdhfJsJF0LGr9VB3d5Gzkgw5dEX3hzhgl+X/eoq/1zdpYCP6dxpLIJrbqK MvDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1705569367; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=b8i0RMZEIwtl4D2A/Ms2VftYD5s8h+rLElxyoyKw0uc=; b=ch1uKrmn1bM40Qj8NP0bjbOEJn93FkmVEY9aB4DoQDEhB/zVjYjjb22g4+vXwHHF9a a7+l2aUMXdtZwgFLV7DYI+WrkbcICAKQXpkIwtUHS2K6YP1Zst3/SwB0Vb8WQPwtH9FM guTqn4KAxXtlOGrzunCTxrlUy5Wg8z/smobdHNdhHwXU2II7YM4IL9PiezIc82LcSEMw qxGSwr4ZxQmBqASXUL81innH0Y3FYJAFbUaFtqiv1yPA3k7qH/QLA8dC2xz0TX7VjYvP HtNRw9ubEQXLba0xLuPpuSGs3vDB0f6lHxDNG84OHDmte8LToVGbj7pajHx35d48mCG5 avRQ== 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=1705569367; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=b8i0RMZEIwtl4D2A/Ms2VftYD5s8h+rLElxyoyKw0uc=; b=QG3RQq+T9UDzMXZraNjImoniI6O+uYVYrIw2NMjz+4TnF+4ryEx/7kKv4xlPkvH5HL sQtpBsumFLzF40VnJ2XtoOW0jd3LHcnwNmZ0dlOhYugSDIyJPmwVO6rw9++KQ5sVt+91 JUjDUhsiGf1AMnWR5SJ/J0iTXcDj/lrtAcawCmxHpMzZi03sxGBNjaSJW5LB/9BEJBuJ 7BNsP/Aw7URVTme67EycEtptz8pqgSXoEC65eDIjSvWr9V2gPeSJ/D1PHTVROkqqyU4D RbMFT7IXTAfG1td2Vie/c/tOkQUpcNcKtabalXg5EWTG3rLJPclPPTzuiFtBRSI50sHo 6DDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1705569367; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=b8i0RMZEIwtl4D2A/Ms2VftYD5s8h+rLElxyoyKw0uc=; b=xS/B3c1VXJKIhShWpe6BGPgQdfrQAOEAWgwGsfWC4XiPu1+Yxf6FYHe+fnAdhezAvM Ds4cUfz52aIJ4DsFFoBw== 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 g5de8600I9G7t1D (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Thu, 18 Jan 2024 10:16:07 +0100 (CET) Message-ID: <5b9af5ae-b89c-4970-a2e4-8d119f3a4515@gjlay.de> Date: Thu, 18 Jan 2024 10:16:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Georg-Johann Lay To: gcc-patches@gcc.gnu.org Subject: [patch,avr,applied] Minor fixes in device-specs generation X-Spam-Status: No, score=-11.0 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_H4, 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+patchwork=sourceware.org@gcc.gnu.org This fixes a typo in the diagnose of a spec. Also re-uses a spec for a simpler specs file. Johann --- AVR: Fix typo in device-specs generation. Reuse -m[no-]rodata-in-ram checker. gcc/ * config/avr/gen-avr-mmcu-specs.cc (diagnose_rodata_in_ram): Fix typo in the diagnostic, and capitalize the device name. (print_mcu): Generate specs such that: <*check_rodata_in_ram>: New. <*cc1_misc>: Use check_rodata_in_ram instead of cc1_rodata_in_ram. <*link_misc>: Use check_rodata_in_ram instead of link_rodata_in_ram. <*cc1_rodata_in_ram, *link_rodata_in_ram>: Remove. diff --git a/gcc/config/avr/gen-avr-mmcu-specs.cc b/gcc/config/avr/gen-avr-mmcu-specs.cc index eb9ab8854d8..72841b1bb42 100644 --- a/gcc/config/avr/gen-avr-mmcu-specs.cc +++ b/gcc/config/avr/gen-avr-mmcu-specs.cc @@ -143,22 +143,28 @@ diagnose_mrodata_in_ram (FILE *f, const char *spec, const avr_mcu_t *mcu) const bool rodata_in_flash = (arch_id == ARCH_AVRTINY || (arch_id == ARCH_AVRXMEGA3 && have_avrxmega3_rodata_in_flash)); + // Device name as used by the vendor, extracted from "__AVR___". + char mcu_Name[50] = { 0 }; + if (! is_arch) + snprintf (mcu_Name, 1 + strlen (mcu->macro) - strlen ("__AVR___"), + "%s", mcu->macro + strlen ("__AVR_")); + fprintf (f, "%s:\n", spec); if (rodata_in_flash && is_arch) - fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram not supported" + fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram is not supported" " for %s}", mcu->name); else if (rodata_in_flash) - fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram not supported" - " for %s (arch=%s)}", mcu->name, arch->name); + fprintf (f, "\t%%{mrodata-in-ram: %%e-mrodata-in-ram is not supported" + " for %s (arch=%s)}", mcu_Name, arch->name); else if (is_arch) { if (! have_flmap2 && ! have_flmap4) - fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram not" + fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram is not" " supported for %s}", mcu->name); } else if (! have_flmap) - fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram not supported" - " for %s (arch=%s)}", mcu->name, arch->name); + fprintf (f, "\t%%{mno-rodata-in-ram: %%e-mno-rodata-in-ram is not supported" + " for %s (arch=%s)}", mcu_Name, arch->name); fprintf (f, "\n\n"); } @@ -265,6 +271,9 @@ print_mcu (const avr_mcu_t *mcu) } #endif // WITH_AVRLIBC + // Diagnose usage of -m[no-]rodata-in-ram. + diagnose_mrodata_in_ram (f, "*check_rodata_in_ram", mcu); + // avr-gcc specific specs for the compilation / the compiler proper. int n_flash = 1 + (mcu->flash_size - 1) / 0x10000; @@ -285,9 +294,7 @@ print_mcu (const avr_mcu_t *mcu) : "\t%{mabsdata}"); // -m[no-]rodata-in-ram basically affects linking, but sanity-check early. - diagnose_mrodata_in_ram (f, "*cc1_rodata_in_ram", mcu); - - fprintf (f, "*cc1_misc:\n\t%%(cc1_rodata_in_ram)\n\n"); + fprintf (f, "*cc1_misc:\n\t%%(check_rodata_in_ram)\n\n"); // avr-gcc specific specs for assembling / the assembler. @@ -332,9 +339,6 @@ print_mcu (const avr_mcu_t *mcu) fprintf (f, "*link_relax:\n\t%s\n\n", LINK_RELAX_SPEC); - // -m[no-]rodata-in-ram affects linking. Sanity check its usage. - diagnose_mrodata_in_ram (f, "*link_rodata_in_ram", mcu); - fprintf (f, "*link_arch:\n\t%s", link_arch_spec); if (is_device && flash_pm_offset) @@ -356,7 +360,8 @@ print_mcu (const avr_mcu_t *mcu) fprintf (f, "\n\n"); } - fprintf (f, "*link_misc:\n\t%%(link_rodata_in_ram)\n\n"); + // -m[no-]rodata-in-ram affects linking. Sanity check its usage. + fprintf (f, "*link_misc:\n\t%%(check_rodata_in_ram)\n\n"); // Specs known to GCC.