alias of structure members

Ian Lance Taylor iant@google.com
Sun Feb 12 05:41:00 GMT 2012


Ángel González <keisial@gmail.com> writes:

> I'm trying to define some symbols which are just alias to the struct
> members of
> a global/static variable.
>  
> See testcase below:
>  
> struct Foo_struct {
>        int Foodata;
> } Foo;
>  
> extern int __attribute__((alias("Foo.Foodata"))) Localfoo;

...

> This syntax works fine in gcc 3.4 but seems to have disappeared in gcc4,
> where it complains that the symbol is aliased to undefined symbol.

I don't see any evidence that this actually worked in gcc 3.4.  In 3.4
it would make Localfoo an alias for a symbol named literally
"Foo.Foodata".  it would not make Localfoo an alias for the Foodata
field of the global variable Foo.  I think gcc4 is kindly giving you an
error for something that never actually worked.

Ian



More information about the Gcc-help mailing list