how to parse the special define
Ian Lance Taylor
iant@google.com
Wed Jan 5 16:52:00 GMT 2011
bb c <chenbenbin@gmail.com> writes:
> Could anyone get me the suggestions how to parse exp, int a @
> address, in GCC. Change the lex codes or change it to below? Thanks.
>
> #pragma a @ address
> int a;
What are you really trying to do? If you want the variable a to be
located at a specific address, then the normal approach in gcc would be
to use a variable attribute. To be clear, gcc does not support any such
variable attribute at present. In a conventional Unix environment, I'm
not sure how that could be implemented. In particular I don't think
there would be any way to implement it for an initialized variable. The
usual way to put a variable at a specific memory address would be to use
an attribute to put the variable in a specific section and to use a
linker script to put that section at a specific address.
Ian
More information about the Gcc-help
mailing list