* .noinit and .persistent alignment
@ 2023-07-12 1:38 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-07-12 1:38 UTC (permalink / raw)
To: binutils
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-12 1:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-12 1:38 .noinit and .persistent alignment Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).