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? I checked around with Google and looked through the code a little…I can see weak support converted to objc_gc(weak) for Darwin and Solaris, but nothing for Linux. I was compiling libxml2 and the Verifier didn’t like ‘__attribute(weak);’ for an extern function declaration, so I thought I would ask.
Thanks,
K.Wilson
P.S. I can just stick in some dummy functions for the weak functions (like in the test/CodeGen/attributes.c file) and I get past the Verifier but then llvm-ld gets into an infinite loop.
Hunh. It shouldn't be too hard to support - is there a bug for it? If it's supported in some way (objc_gc? weird.) on darwin it should be easy to support on linux.
-eric
Hey Eric,
There is no bug filed for this, that I could see.
I did get libxml2 to compile without pthread support and 'make tests' worked
(though I am apparently missing some test xml files...but at least there
were no fatal errors and 'testapi' seemed fine excluding pthread tests).
So my question on '__attribute(weak)' still stands, but at least I could get
around it.
Thanks,
K.Wilson
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:
- on a function with a definition, it allows the body to be overridden
- 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