Output section of string literal in initializer
Udo A. Steinberg
us15@os.inf.tu-dresden.de
Thu Mar 22 16:38:00 GMT 2007
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
More information about the Gcc-help
mailing list