From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 251B83858C62 for ; Wed, 12 Jul 2023 01:38:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 251B83858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-51b4ef5378bso4685691a12.1 for ; Tue, 11 Jul 2023 18:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689125912; x=1691717912; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=YmG3JGmx4bGz5CC17jzDVEmC9UWp5Yk7fYMqQBIwMR8=; b=lIym1SyYTlwKDl7MvEI3+bCldiUOfGdqbQfn6LVO1/tnSPPkaHpYf07D8BFs9Udbtp XMTxaOfXt7wRnE5eW0o7IPztZGW9aoYuL1a3zUFkJvYiTxuLjI2UOFhm8eiVJtAXY4CQ oCN3vn4dMkJB0nGd4Cui3W5uadv+qZBl+DCfFueOxsCtKcnRINCPUg9f3r83NBZQ/puh 87aQLkVIQj/uS6zp6rp/77mGpxAwiIV8s1HTpLhLR5eJZeouIapgPeIlx/6cXs/wdxQQ dmQu9YMueTqHApQwuhsC6Y9C16by12aeXGKQw2YljVqDWdQm/DyLMTYnWOUqz+9WYDkh VPpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689125912; x=1691717912; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YmG3JGmx4bGz5CC17jzDVEmC9UWp5Yk7fYMqQBIwMR8=; b=GwTJXTTjT1GvqiUR0G0aHT1qXoQe+bNY2kxLdQtsCt9Kk8uxRBd4KiMviPMNEd5Bzz xDgbmo1KDwpNL8NjEBalmFaLIrhUseaNpuJNBk0RcLtnr0lCb/E93BTaQH0UeQyW3oTx J3u1QnJ7srFPAuv6OPaig41uUenBCO3X7aY3r632WuU/Ii1dblMhwOTTKHRYsmxURWu8 B4+UiMZfBFPvJz2wTIdY+My4QyGld5E5XNBxVBJvcj1kvtxttAeDxsleQzTdcRQ2kd/Y E46ZqdgFgzH+cl+P03VuSdfxsLM/5PP+OzowTO9TLHQ8fr7JMTvHPdTaroDw61GCzZJu dDqA== X-Gm-Message-State: ABy/qLZOonLR6TjFykin3ba5rGFDiG+2d2n/8EULxyRah2x7F9IR/4dq d8D9dXfTPyQXqS3d3JZEsqGJ/Cs8994= X-Google-Smtp-Source: APBJJlEBARJr2bCcb/8lfgbruZHDZ8gFZr9KPk9BLMabxIrLBXiCMLkwZhH8EAdYq0pKOZKeOUK+aA== X-Received: by 2002:a17:902:e74b:b0:1b8:ac67:c2b with SMTP id p11-20020a170902e74b00b001b8ac670c2bmr20981851plf.21.1689125912379; Tue, 11 Jul 2023 18:38:32 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:80d7:5d82:afc0:aec1]) by smtp.gmail.com with ESMTPSA id h6-20020a170902f7c600b001b9d7c8f44dsm2598182plw.182.2023.07.11.18.38.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 18:38:31 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 6E8A31142A71; Wed, 12 Jul 2023 11:08:28 +0930 (ACST) Date: Wed, 12 Jul 2023 11:08:28 +0930 From: Alan Modra To: binutils@sourceware.org Subject: .noinit and .persistent alignment Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3034.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: It's more elegant to make the section match up with its "_start" symbol. We could align by setting the address of the section (by using ALIGN before the colon), but this way we also set sh_addralign to at least $ALIGNMENT. * scripttempl/elf.sc (.noinit, .persistent): Align the output section rather than using ". = ALIGN();" at the beginning. Set address to zero when not a final link. diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index bfd8b5ed4b3..82de4ed9f88 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -342,9 +342,8 @@ STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : test "${HAVE_NOINIT}" = "yes" && NOINIT=" /* This section contains data that is not initialized during load, or during the application's initialization sequence. */ - .noinit (NOLOAD) : + .noinit ${RELOCATING-0} (NOLOAD) : ${RELOCATING+ALIGN(${ALIGNMENT})} { - ${RELOCATING+. = ALIGN(${ALIGNMENT});} ${RELOCATING+PROVIDE (__noinit_start = .);} *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*}) ${RELOCATING+. = ALIGN(${ALIGNMENT});} @@ -353,9 +352,8 @@ test "${HAVE_NOINIT}" = "yes" && NOINIT=" test "${HAVE_PERSISTENT}" = "yes" && PERSISTENT=" /* This section contains data that is initialized during load, but not during the application's initialization sequence. */ - .persistent : + .persistent ${RELOCATING-0} : ${RELOCATING+ALIGN(${ALIGNMENT})} { - ${RELOCATING+. = ALIGN(${ALIGNMENT});} ${RELOCATING+PROVIDE (__persistent_start = .);} *(.persistent${RELOCATING+ .persistent.* .gnu.linkonce.p.*}) ${RELOCATING+. = ALIGN(${ALIGNMENT});} -- Alan Modra Australia Development Lab, IBM