Rabih Chrabieh <chrabieh@xxxxxxxxx> writes: > I will add the following question: for variables, it doesn't seem like there is > a mechanism to create an "alias" that is "local" to a file. > > It seems like we must use "extern" (otherwise the compiler reports that the > variable is "defined both normally and as an alias"). > And if we use extern, we cannot combine it with "static" (the compiler reports > "multiple storage classes"). > > Hence, contrary to functions, it looks like an aliased variable is always > global (the assembler is always using .global). This is partly an issue of the > C language that extern and static cannot be combined for variables, but extern > can be omitted for functions. Unless there is a trick that you know of? > > In summary, these constructs work properly for functions but not for variables: > > static void f() {return;} > static void g() __attribute__((alias("f"))); > > static int AAA; > extern static int BBB __attribute__((alias("AAA"))); I'm actually surprised that that works for functions. I would encourage you to file a bug report about this. See http://gcc.gnu.org/bugs.html . Thanks. Ian