Output section of string literal in initializer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

In the example below I would like the string literals "foo", "bar" and "baz" to
reside in .mysection. This works when using a pointer variable ptr as shown for
"baz".

Is there any way to specify the output section of string literals in an
initializer (e.g., "foo" and "bar") without using using a pointer variable?
I'm looking for something like { "foo" MYSECTION, 1 }.

#define MYSECTION __attribute__((section (".mysection")))
char const *const ptr MYSECTION = "baz";
struct
{
    char const *string;
    unsigned number;
} x[] MYSECTION =
{
    { "foo",     1 },
    { "bar",     2 },
    {  ptr,      3 },
};



Cheers,

	- Udo

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux