[PATCH] ARM: Support .noinit and .persistent sections in ELF linker script

Jozef Lawrynowicz jozef.l@mittosystems.com
Wed Nov 25 13:40:49 GMT 2020


On Wed, Nov 25, 2020 at 12:36:25PM +0000, Nick Clifton via Binutils wrote:
> Hi Jozef,
> 
> > > > 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.
> 
> > > Are these sections ARM specific ?
> 
> > 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.
> 
> If you are willing to take on this additional work and make this
> change then I think that it would be a good idea.  Having generic
> support for a feature used by more than a few targets makes sense
> to me.  Plus cleaning up duplicated code is always useful.

I'm happy to do that, I'll put together a new patch soon.

Thanks,
Jozef


More information about the Binutils mailing list