This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

section placement q


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-

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]