SMP_ON_UP fixups lead to vmlinux link errors if those sections are discarded at link-time. In particular this may happen for built-in __exit stuff. This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that __exit sections are kept in. This is a hack and probably wrong! Further discussion is needed. Signed-off-by: Dave Martin <dave.martin@xxxxxxxxxx> --- On Wed, Jan 26, 2011 at 12:44:52PM +0000, Russell King - ARM Linux wrote: > On Wed, Jan 26, 2011 at 11:11:31AM +0000, Dave Martin wrote: > > Do we need to consider any other discarded sections? In vmlinux.lds, I have: > > > > /* Default discards */ > > /DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text) > > *(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) > > *(.memexit.rodata) *(.exitcall.exit) *(.discard) *(.discard.*) } > > We need to keep all the text exit stuff, and that could well want > data exit stuff, so I think we need ot keep most of that. Maybe not > the .discard* stuff though. > > > If we put every fixup in its own _section_ we might be able to > > collapse those out of the list at link time too. However, that seems > > hard to achieve, since in order to do the correct link-time filtering > > we would need the fixup's section name to be based on the referenced > > section's name ... due to preprocessor limitations I don't think we > > can do that automatically (and manual maintenance would be a bad > > plan). > > I suspect if it was sanely possible to do, then x86 would already be > doing it as they've had this problem for a lot longer than we have. > It might be worth talking to toolchain people to see if it can be made > to work somehow - but we really don't want to get rid of all discarded > section warnings. > > IOW, if we have a text segment which is included in the image and it > references discarded .exit text, we really do want it to fail at link > time. diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 45b5651..473e30e 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -85,6 +85,7 @@ SECTIONS * unwind exit sections must be discarded before the rest of the * unwind sections get included. */ +#ifndef CONFIG_SMP_ON_UP /DISCARD/ : { *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text) @@ -99,6 +100,7 @@ SECTIONS *(__ex_table) #endif } +#endif .text : { /* Real text segment */ _text = .; /* Text and read-only data */ @@ -107,6 +109,12 @@ SECTIONS __exception_text_end = .; IRQENTRY_TEXT TEXT_TEXT +#ifdef CONFIG_SMP_ON_UP + *(.exit.text) + CPU_KEEP(exit.text) + DEV_KEEP(exit.text) + MEM_KEEP(exit.text) +#endif SCHED_TEXT LOCK_TEXT KPROBES_TEXT @@ -116,6 +124,11 @@ SECTIONS *(.gnu.warning) *(.rodata) *(.rodata.*) +#ifdef CONFIG_SMP_ON_UP + CPU_KEEP(exit.rodata) + DEV_KEEP(exit.rodata) + MEM_KEEP(exit.rodata) +#endif *(.glue_7) *(.glue_7t) . = ALIGN(4); @@ -188,6 +201,11 @@ SECTIONS * and the usual data section */ DATA_DATA +#ifdef CONFIG_SMP_ON_UP + DEV_KEEP(exit.data) + CPU_KEEP(exit.data) + MEM_KEEP(exit.data) +#endif CONSTRUCTORS _edata = .; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html