This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: handling of symbol prefixes in the "target" of the alias("target") attribute
- From: Mike Frysinger <vapier at gentoo dot org>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 27 May 2009 01:51:39 -0400
- Subject: Re: handling of symbol prefixes in the "target" of the alias("target") attribute
- References: <200905262120.46794.vapier@gentoo.org> <m3ab4zrwc9.fsf@google.com>
On Wednesday 27 May 2009 00:41:42 Ian Lance Taylor wrote:
> Mike Frysinger <vapier@gentoo.org> writes:
> > i'm wondering whether it is expected that the "target" of the alias()
> > attribute should automatically handle the symbol prefix
> > (__USER_LABEL_PREFIX__). the documentation doesnt mention anything along
> > these lines, but going by existing ports like Windows and Blackfin/Linux,
> > it would seem that they do. however, it seems like Apple's gcc fork does
> > not. it also seems more logical for the prefix to be handled
> > transparently rather than forcing everyone to do magic CPP crap with
> > __USER_LABEL_PREFIX__. -mike
>
> As far as I know it was never documented. However, every target that I
> checked does add __USER_LABEL_PREFIX__ before the alias name.
perhaps this change would be appropriate then ?
--- trunk/gcc/doc/extend.texi (revision 147891)
+++ trunk/gcc/doc/extend.texi (working copy)
@@ -1868,8 +1868,8 @@ void __f () @{ /* @r{Do something.} */;
void f () __attribute__ ((weak, alias ("__f")));
@end smallexample
-defines @samp{f} to be a weak alias for @samp{__f}. In C++, the
-mangled name for the target must be used. It is an error if @samp{__f}
+defines @samp{f} to be a weak alias for the C visible @samp{__f}. In C++,
+the mangled name for the target must be used. It is an error if @samp{__f}
is not defined in the same translation unit.
Not all target machines support this attribute.
@@ -3308,8 +3308,8 @@ and linker.
@cindex @code{weakref} attribute
The @code{weakref} attribute marks a declaration as a weak reference.
Without arguments, it should be accompanied by an @code{alias} attribute
-naming the target symbol. Optionally, the @var{target} may be given as
-an argument to @code{weakref} itself. In either case, @code{weakref}
+naming the target (C visible) symbol. Optionally, the @var{target} may be
+given as an argument to @code{weakref} itself. In either case,
@code{weakref}
implicitly marks the declaration as @code{weak}. Without a
@var{target}, given as an argument to @code{weakref} or to @code{alias},
@code{weakref} is equivalent to @code{weak}.
-mike