[PATCH v2] ARM: Avoid discarding sections that might have SMP_ON_UP fixups SMP_ON_UP fixups

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Jan 27 11:46:01 EST 2011


On Thu, Jan 27, 2011 at 02:37:09PM +0000, Dave Martin wrote:
> On Wed, Jan 26, 2011 at 04:31:37PM -0500, Nicolas Pitre wrote:
> > Since discarded sections are by definition not used, we should at least 
> > put them into the .init section so to discard them at run time.  And 
> > only the EXIT_TEXT and EXIT_DATA would need to be kept (see x86 for 
> > example).
> > 
> > 
> > Nicolas
> 
> I'll check up on whether we need to care about writable data.
> For now I've just attempted to move stuff to .init.

You can keep the discarding of the unwind data for exit sections as
the exit sections don't depend on the unwind data.

It's all to do with sections being referenced from other sections.  If
a section being kept references a section being discarded, then the
linker will error out.  You need to keep any section that is being
referenced - but you don't need to keep sections which only reference
those being kept.

I'd also prefer to see a 'KEEP_EXIT' macro as I think we can discard
these sections in more cases than just SMP_ON_UP.  I think it's:

SMP_ON_UP && !DEBUG_SPINLOCK

which requires it.  So if you have spinlock debugging enabled you can
discard the exit sections.  See include/linux/spinlock.h.



More information about the linux-arm-kernel mailing list