[LLVMdev] weak linkage

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Dec 6 04:38:39 PST 2006

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())

Can a initializer be a weak reference? For example,
int a __attribute__ ((weak));
int b = a;
fails to compile with the error:
test.c:2: error: initializer element is not constant

Best Regards,

More information about the llvm-dev mailing list