[PATCH] ARM: Support .noinit and .persistent sections in ELF linker script
Jozef Lawrynowicz
jozef.l@mittosystems.com
Tue Nov 24 17:44:59 GMT 2020
On Tue, Nov 24, 2020 at 05:24:26PM +0000, Nick Clifton via Binutils wrote:
> Hi Jozef,
Hi Nick,
> > Support for the "persistent" attribute, to place variables in the
> > ".persistent" section, has been added to GCC and needs to be handled in
> > the default ARM ELF linker script.
> >
> > The ".persistent" section is for data that is initialized during load,
> > but not during application reset.> Unique .noinit.* and
> > .gnu.linkonce.n.* sections were unhandled within
> > the .noinit output section, this patch also fixes that.
> >
> > Successfuly regtested the LD testsuite for arm-none-eabi, ok to apply?
>
> Are these sections ARM specific ? I ask because the names (.noinit,
> .persistent, .gnu.linkonce.n) look to be generic, and if the intention
> is that they can be used on other architectures, then maybe the correct
> place to add these is the ld/scripttempl/elf.sc script ...
>
> If they are ARM specific, then maybe the names should be changed to, eg,
> .ARM.persistent, etc.
The sections are not ARM-specific, GCC supports the corresponding
"persistent" and "noinit" attributes for all ELF targets. In the real
world, the sections must be placed in some non-volatile type of
writeable memory, so may not be supported for some targets.
In addition to ARM, it looks like AVR, ARC, MSP430, and PRU already
support a .noinit section in their default linker scripts.
.persistent is only used by MSP430 so far.
So I could move the definitions to elf.sc, as long as it would not be
considered intrusive for targets using elf.sc as a base, but don't
support .noinit or .persistent.
I would also then need to remove the corresponding .noinit output
section from the above targets using elf.sc as a base linker script, so
there aren't duplicate definitions of that output section.
Thanks,
Jozef
More information about the Binutils
mailing list