Re: the creation of boot_cpu_init() is wrong and accessinguninitialised data

From: Andrew Morton
Date: Tue Jun 27 2006 - 22:56:25 EST


On Tue, 27 Jun 2006 22:45:34 -0400
James Bottomley <James.Bottomley@xxxxxxxxxxxx> wrote:

> On Tue, 2006-06-27 at 17:04 -0700, Andrew Morton wrote:
> > +static void __init __attribute__((weak)) smp_setup_processor_id(void)
>
> If you're really sure this works .. then it looks OK.

We do it quite a lot actually.
box:/usr/src/linux-2.6.17> grep -r 'attribute.*weak' . | wc -l
91

> However, I
> thought weak was a linker attribute, not a compiler one.

Yes, it is mainly a linker thing. But the compiler has to emit the ".weak"
pseudo-op and not inline the function.

> How does the
> compiler know if the static inline needs to be incorporated or if a
> strong symbol is going to override it when the whole thing is linked
> together at the time it just compiles main.c?

I didn't mark it inline.

If the compiler chose to inline it then that would be rather dumb of it,
given that it had the weak attribute. But yes, paranoia says we should be
tagging this noinline too.

> > Is that all OK?
>
> I'll give it a whirl tomorrow when I get access to one of the voyager
> systems in Columbia.

Thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/