Re: how interesting are data->bss patches?

From: Jeff Garzik (jgarzik@mandrakesoft.mandrakesoft.com)
Date: Sun Sep 24 2000 - 09:04:17 EST


On Mon, 25 Sep 2000, Keith Owens wrote:
> Jeff Garzik <jgarzik@mandrakesoft.mandrakesoft.com> wrote:
> >I am glad this was mentioned... It is a valid use of __initdata for
> >static variables which you want to go away after boot. There might be
> >some wasted space lurking here and there due to un-init'd __initdata
> >vars.
>
> Another case to look at. I discovered that
>
> char __initdata *cmd[] = {
> "command1",
> "command2",
> "command3",
> NULL
> };
>
> Stores the 4 pointers of cmd in .init.data but the strings are down in
> .rodata, i.e. they are not discarded after init. I got around it by
>
> static __initdata char str_command1[] = "command1";
> static __initdata char str_command2[] = "command2";
> static __initdata char str_command3[] = "command3";
> char __initdata *cmd[] = {
> str_command1,
> str_command2,
> str_command3,
> NULL
> };

That reminds me that the tree has some stuff like the following, that
should be cleaned up. Clearly the intention of developer is not the
result here...

static char *foo __initdata = "bar";

Once again, just the pointer is actually __initdata. Changing it to
char foo[] fixes things...

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



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:12 EST