[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())
    ExtWeakSymbols.insert(Mang->getValueName(GV));
------------------------------------------------

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,
Rafael



More information about the llvm-dev mailing list