From patchwork Mon Feb 12 10:50:55 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: 1897683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gjlay.de header.i=@gjlay.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=nWUfWmKD; dkim=pass header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=5LBOtjKc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TYLqG1SGfz23fC for ; Mon, 12 Feb 2024 21:51:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 154813858D32 for ; Mon, 12 Feb 2024 10:51:18 +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.220]) by sourceware.org (Postfix) with ESMTPS id 52C853858D32 for ; Mon, 12 Feb 2024 10:50:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52C853858D32 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 52C853858D32 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.220 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1707735059; cv=pass; b=HSTMLviGb6sqCFXYfi7COy03/zZPIPkAW1fDmlyud6t7IwOqVFAf682EhSyOSGUgNBTi6ad2JQ6kp+gVtRQ4SYrtbNVSZNU/srenm/IUv1jNNVZbrWnaKpwDU564u9U9yRM648vzSyMK4YX/+u8Z7zApSCGvPBM4EBHS0cXtrHc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1707735059; c=relaxed/simple; bh=T16cKRSj2bKXMZwlrLId4lDhp3yAj0XH+S6pWauaL4Y=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=b+pD5kuU3M8XUVuC56CAoiwG9p3eAqSevKaPA3WLdTojkvPj1b+HDBAa/cpQuSVnAcXX7hNrlHaZgr8ybHn6tNjm4r0TSAE2jP6EFvnjYiu3l1UZg4+5a0wo52BMkd+Dv4iRO/OFGz/A6GSG+JLvfNGcbbEE/8BZkr2sWqi2kRo= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1707735056; cv=none; d=strato.com; s=strato-dkim-0002; b=rXaZuvNgpVQAUhKNlKXgtMovXSI9aMpLLrAWeah5N1XrGO07MSsR3ho0No6iE4ND8W XNzPOz+gZNwhAQ1o7ZZP1Au41Xs9XIGY1ZZO1Yc34MrAe4b1lsi4c9eh8o5JG9UZjPRI im8Otx+/3v5UveubIr0WCe8RhiBRJmO80Is2SFXJdcB0J2Do8S3t4Vi92Br+mrmV1iS2 6JQux/Orl8M8mDy5o5AUjKYQ6/yIAqSYEl0Jh6AxnTFy1m1iwDHcHlBkAE3WC1ELcFOf ojJkt1nWGCDAMuSIZG/zu4++BgdsuF1zAx2K4pX0oO37n7jNnwPPsfPX7q8JnvX1da5n QA9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1707735056; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=ExQKf5fdaZzicKilqVK+Gdmk/UYnbXLGKb2dIdBemPY=; b=kuX5BdIs7+aO4QcdYyBd50aB4dStT2f+zsJi5Lpm8to75AaWijblcP0poendYGvr8Z kMjUPTSxoK+euImH5Fs7VO7xdByjt9XrTQxxE7YGY2tdLFpVepKFR5ycVICASBB2K34h P4Zvj080zVjhmqfYRLYyyuuvPRy1mECuJjLmzhdT/Q5SBuOOaqqCsurbVQ+EbJvO406p BLa3rUFw3p2BJMnSS86EjleOfOEGJe23cnTi4GoeqE6UBIEsSRYWOyij52t8+rj9mlqS V+F2219Aiy9Z7mibYvoFLYH2Afp94npmcGmGLncyWGIA2Zr1rpfLmO7kFFnvm+VaBo0J xkMQ== 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=1707735056; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=ExQKf5fdaZzicKilqVK+Gdmk/UYnbXLGKb2dIdBemPY=; b=nWUfWmKDMGV+Ao8B1zQui3X07rO1EFw/MmH5owxSArTOsge5WxMzGLETz1+GJSPSO+ F8D2mjBlJU+1G52Z/RGvuh4dSmWcYIK9VBsVD6yy2UcPb25gbQ3/MnkERupbR8eCn72W MuSu1VjzCs+9VQA845j39sVlmYCtJbDHM1gm0Pj/wzyBt34bG+PtS9BnClEAMaugCHcG URFBdT3E0fNrqLhbY4JEbvS8Zpjf15tb/qq+JHYfwg9vaOiK2xwRcZg0V/s3Qe+lpSu5 RaDDwCdk0hCejdKGVfaOyxR15FygF7LTi3QiQBAEzuXCn+0xJR3GfESfNj1v4ZaiYrBe jOCA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1707735056; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=ExQKf5fdaZzicKilqVK+Gdmk/UYnbXLGKb2dIdBemPY=; b=5LBOtjKcNz1+6p7juOTvqulqhTb80ILXbRwe/6ZybECIhgi/SbS0syNsHBClk5To27 OrpR8FfA8XYU+LXikyDw== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkSgcSjpmy9KwoMJ/K0VA==" Received: from [192.168.2.102] by smtp.strato.de (RZmta 49.11.2 DYNA|AUTH) with ESMTPSA id Lb68c601CAotjuy (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Mon, 12 Feb 2024 11:50:55 +0100 (CET) Message-ID: Date: Mon, 12 Feb 2024 11:50:55 +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] Addendum to target/112944: Initialize FLMAP as needed X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org This code will link against parts of the startup code from AVR-LibC when it is needed to init bit-field FLMAP. Johann --- AVR: target/112944 - Addendum: Link code to initialize NVMCTRL_CTRLB.FLMAP For devices that see a part for the flash memory in the RAM address space, bit-field NVMCTRL_CTRLB.FLMAP must match the value of symbol __flmap. This is achieved by dragging in startup code from lib.a. The mechanism is the same like for libgcc's __do_copy_data and __do_clear_bss. The code is implemented in AVR-LibC #931 and can be dragged by referencing __do_flmap_init. In addition to setting FLMAP, that code also sets bit FLMAPLOCK provided symbol __flmap_lock has a non-zero value. This protects FLMAP from future changes. When the __do_flmap_init code is not wanted, the symbol can be satisfied by linking with -Wl,--defsym,__do_flmap_init=0 gcc/ PR target/112944 * config/avr/gen-avr-mmcu-specs.cc (print_mcu) [have_flmap]: <*link_rodata_in_ram>: Spec undefs symbol __do_flmap_init when not linked with -mrodata-in-ram. diff --git a/gcc/config/avr/gen-avr-mmcu-specs.cc b/gcc/config/avr/gen-avr-mmcu-specs.cc index ea69145d404..bb94bea12b0 100644 --- a/gcc/config/avr/gen-avr-mmcu-specs.cc +++ b/gcc/config/avr/gen-avr-mmcu-specs.cc @@ -369,7 +369,10 @@ print_mcu (const avr_mcu_t *mcu, const McuInfo &mi) } // -m[no-]rodata-in-ram affects linking. Sanity check its usage. - fprintf (f, "*link_rodata_in_ram:\n\t%%(check_rodata_in_ram)\n\n"); + fprintf (f, "*link_rodata_in_ram:\n\t%%(check_rodata_in_ram)"); + if (mi.is_device && mi.have_flmap) + fprintf (f, " %%{!mrodata-in-ram:-u __do_flmap_init}"); + fprintf (f, "\n\n"); // Specs known to GCC.