Re: 2.6.23-rc4-mm1 build issue: ia64 link error
From: Satyam Sharma
Date: Sat Sep 08 2007 - 03:35:31 EST
On 9/7/07, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, 7 Sep 2007 00:34:59 -0700 "Luck, Tony" <tony.luck@xxxxxxxxx> wrote:
> > > local symbol 0: discarded in section `.exit.text' from arch/ia64/kernel/built-in.o
> >
> > This usually means that there is a static __exit function (or __devexit etc.)
> > somewhere in the object being linked. The error message is pretty unhelpful
> > in figuring out *where* in the module. Look at the 'mm' patches that touch
> > arch/ia64/kernel to see if one of them tinkers with __exit* attributes.
>
> Confused. There are >2500 static __exit functions in the tree, including
> ones like
>
> arch/ia64/kernel/esi.c:static void __exit esi_exit (void)
That message means the linker found someone referencing an .exit.text
function -- on other archs this would've been a section mismatch but on
ia64 its a link error due to reasons below (although it would not have ever
caused an oops).
The message /is/ quite helpful actually -- you just need to objdump the
mentioned object file (arch/ia64/kernel/built-in.o) and see all functions
present in .exit.text (which turns out to be only four). Then cscope them
in the kernel tree and see which (if any) are referenced from non-__exit
code ...
> Could we have some more details on what you think has gone wrong here?
... and it turns out my ia64-tree-wide-misc-__cpuinitdata-init-exit.patch is
to blame here.
I just confirmed from arch/ia64/kernel/vmlinux.ld.S, that ia64 discards .exit.*
sections at link time itself -- unlike other archs such as x86 that drop it at
boot (after initcalls) time instead. And hence the "function that is referenced
only from __cpuinit or __exit can be marked __cpuexit" rule does not hold
true for ia64, sadly.
Now that patch made remove_palinfo_proc_entries() a __cpuexit function,
with the reasoning that it was only referenced from the __cpuinit notifier
callback and the general __exit function of that module. But the following
combination:
1. HOTPLUG_CPU=n in Mathieu's .config, and,
2. ia64's build-time .exit.* discarding, and,
3. an old toolchain (gcc-3.4.5) -- therefore ensuring that the notifier callback
wasn't elided from arch/ia64/kernel/built-in.o although nobody references it
ensured that the .init.text-resident palinfo_cpu_callback() referenced the
.exit.text-resident remove_palinfo_proc_entries(), thereby causing link error.
So this is the second goof-up in that "misc cpuinit/exit annotations" series
of mine, apologies. I've installed the ia64 cross-compile toolchain now, so
hopefully should be able to avoid such in future ...
Patch attached (have gmail access only for next few days).
Satyam
Signed-off-by: Satyam Sharma <satyam@xxxxxxxxxxxxx>
---
arch/ia64/kernel/palinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-2.6.23-rc4-mm1/arch/ia64/kernel/palinfo.c~fix 2007-09-08 12:54:12.000000000 +0530
+++ linux-2.6.23-rc4-mm1/arch/ia64/kernel/palinfo.c 2007-09-08 12:54:45.000000000 +0530
@@ -947,7 +947,7 @@ create_palinfo_proc_entries(unsigned int
}
}
-static void __cpuexit
+static void
remove_palinfo_proc_entries(unsigned int hcpu)
{
int j;