This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
section placement q
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Subject: section placement q
- From: Andrew Morton <andrewm at uow dot edu dot au>
- Date: Fri, 12 May 2000 01:14:31 +0000
The linux kernel likes to put lots of things into special sections so
those sections can be unloaded when not neeed. However this is less
effective than it might be because strings are still placed in .rodata.
Example:
struct foo
{
int i;
char *s;
};
struct foo foo_array[] __attribute__ ((__section__(".foosect"))) =
{
{ 12, "foo1" }
};
Here, the integer and the char * are placed in .foosect, but the actual
string "foo1\0" is placed in .rodata.
I believe this behaviour is correct and logical. One probably unpopular
workaround is to change 'char *s' into 'char s[20]'.
Can anyone suggest a construct which will allow the string to be placed
in a different section while retaining the current 'char *' semantics?
Thanks.
--
-akpm-