how to parse the special define

Ian Lance Taylor iant@google.com
Thu Jan 6 15:12:00 GMT 2011


bb c <chenbenbin@gmail.com> writes:

>          but, Is it good way if we use int a __attribute__ ((address
> (0x08))) to handle the variable with address.
>          If we can use it, my question is how to add the new key
> "address" to the attribute table and GCC could handle the attribute?

Whether you can use it depends on how your assembler and linker work.
As I said earlier, there is no reasonable way to make it work for an
initialized variable when using a conventional Unix system.  I don't
think you've said anything about your target.

If you know what you want gcc to generate for this attribute, then it
shouldn't be too hard to modify gcc accordingly.  In current development
sources the attribute table is in gcc/c-family/c-common.c.  Then you
would check for the presence of the attribute in gcc/varasm.c when
emitting the definition of the variable.

Ian



More information about the Gcc-help mailing list