Re: const __init

Jeff Garzik (jgarzik@mandrakesoft.com)
Sun, 20 May 2001 17:34:48 -0400


Geert Uytterhoeven wrote:
>
> On Sun, 20 May 2001, Jeff Garzik wrote:
> > Geert Uytterhoeven wrote:
> > > Since a while include/linux/init.h contains the line
> > >
> > > * Also note, that this data cannot be "const".
> > >
> > > Why is this? Because const data will be put in a different section?
> >
> > Causes a "section type conflict" build error, at least on x86.
>
> On m68k I only saw section type conflict errors when using __init while it
> should have been __initdata.

This might be a very valid point...

(let me know if the following test is flawed)

> [jgarzik@rum tmp]$ cat > sectest.c
> #include <linux/module.h>
> #include <linux/init.h>
> static const char version[] __initdata = "foo";
> [jgarzik@rum tmp]$ gcc -D__KERNEL__ -I/spare/cvs/linux_2_4/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -mpreferred-stack-boundary=2 -march=i686 -c -o sectest.o sectest.c
> [jgarzik@rum tmp]$

No section type conflict appears.

-- 
Jeff Garzik      | "Do you have to make light of everything?!"
Building 1024    | "I'm extremely serious about nailing your
MandrakeSoft     |  step-daughter, but other than that, yes."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/