[LLVMdev] weak linkage

Chris Lattner sabre at nondot.org
Wed Dec 6 12:46:22 PST 2006


On Wed, 6 Dec 2006, [UTF-8] Rafael Esp?ndola wrote:
> I am implementing weak linkage support on the ARM backend and I
> noticed this code on the X86 and PPC backends:
> ------------------------------------------------
> // If the initializer is a extern weak symbol, remember to emit the weak
> // reference!
> if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
>  if (GV->hasExternalWeakLinkage())
>    ExtWeakSymbols.insert(Mang->getValueName(GV));
> ------------------------------------------------
>
> Can a initializer be a weak reference? For example,
> ------------------------
> int a __attribute__ ((weak));
> int b = a;

Try: int *B = &a;

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list