This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: how to parse the special define
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