Re: getting text strings into __initdata for char *foo = "data"

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Nov 20 2002 - 18:43:28 EST


On Wed, 20 Nov 2002, Patrick Mansfield wrote:

> Hi -
>
> Is there a way to get char * initialized data to go into the init
> data section?
>
> For example, in the following I want init_foobar and its associated
> text strings to go into the init data section, not just the pointers
> in init_foobar:
>

[SNIPPED...]

I use assembler when I need to do things 'C' doesn't want
to do.. like:

.section .init.data
.global foo
.type foo,@object
.size foo,11
foo: .string "1234567890"

This will work for ".sections" like .data, etc,. but the
object file in empty when I use .init.data. This is probably
because gas treats .string specially. I know you can do this
with ".byte". You don't have to make the assembly by hand.

I do something like:

#ifdef THIS_WILL_NEVER_BE_DEFINED
char foo[]="This is the string..."
#else
extern char foo[];
#endif

I write a 'C' program that looks for "THIS_WILL_NEVER_BE_DEFINED"
and writes gas assembly for the strings up to the "#else".

I do this in an embedded system to put many/most/all strings
in NVRAM PROM.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
   Bush : The Fourth Reich of America

-
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/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:34 EST