[cfe-dev] Is __attribute(weak) supposed to fail?
Chris Lattner
clattner at apple.com
Sat Jul 12 09:31:32 PDT 2008
On Jul 11, 2008, at 11:07 PM, Kelly W wrote:
> Hello all,
>
> Just wondering if ‘__attribute(weak)’ is supposed to fail in the
> Verifier due to it not being supported at this point for Linux?
No, it works fine with llvm-gcc.
> like ‘__attribute(weak);’ for an extern function declaration, so I
> thought I would ask.
>
The weak attribute does two different things depending on context:
1. on a function with a definition, it allows the body to be overridden
2. on a function prototype, it makes the function "optional" and makes
it resolve to a null pointer if not linked into the app.
The former is llvm::GlobalValue::WeakLinkage, the later
is ..::ExternalWeakLinkage. Clang probably just has the later
confused with the former.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080712/fed4643b/attachment.html>
More information about the cfe-dev
mailing list