Re: how to parse the special define

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

 



Dear lan

     Yes, Gcc don't suport it now. Could we use the pragma to set the
variable attribute and handle the attribute at backend to asm?

      "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."

       Could you tell me how to use the variable attribute to put the
varibable to a specific section? Thanks.

Best Regards
Bien Chen
2011/1/6 Ian Lance Taylor <iant@xxxxxxxxxx>:
> bb c <chenbenbin@xxxxxxxxx> 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
>



[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