[LLVMdev] Linking two external linkage GlobalValues

Bram Adams bram.adams at ugent.be
Fri May 25 07:20:50 PDT 2007


I've been able to link ioquake, but not without a small modification  
to lib/Linker/LinkModules.cpp:427 where I had to add:

   } else if (Dest->hasExternalLinkage() && Src->hasExternalLinkage()){
       LinkFromSrc = true;//overwrite old value
       LT = Src->getLinkage();//use src linkage

The reason is that two files both had a global function pointer  
variable (due to #include's):

void ( *alEnable)( ALenum capability );

which got translated to:

@alEnable = globale void (i32)* null

Linking these resulted in an error (lib/Linker/LinkModules.cpp's  
original catch-all on line 427), but our hack prevents this.

My question: does this change break certain design decisions,  
optimisations, ...?

BTW, why are the error messages of the linker, as constructed by Error 
(...,...), not shown on the command line?

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)

More information about the llvm-dev mailing list