[LLVMdev] Type conflicts with linkonce functions

Nathan Keynes Nathan.Keynes at Sun.COM
Thu Jun 12 23:56:12 PDT 2008


Hi,

     Currently if the linker encounters a pair of linkonce function  
definitions with different types, it raises an error of the form:

llvm-ld: error: Cannot link file 'item.o.bc': Function  
'_ZN18st_select_lex_unit12first_selectEv' defined as both '  
%struct.SELECT_LEX* (%struct.SELECT_LEX_UNIT*)' and '  
%struct.SELECT_LEX* (%struct.SELECT_LEX_UNIT*)'

     I encountered the above while building mysql 5.0.51a after  
dealing with PR1860 - some of the source files appear to have slightly  
different definitions of the same type name, which makes the error  
message especially confusing. In any case, this doesn't seem right - I  
would expect the link to proceed regardless of the type mismatch. The  
patch below is intended to change the linker behaviour in the presence  
of a function type mismatch to add a bitcast but otherwise continue  
linking as normal.

     From what I can see, global variables are already handled this way.

Cheers,
Nathan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: linkonce-mistype.patch
Type: application/octet-stream
Size: 4976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080613/998021f3/attachment.obj>
-------------- next part --------------



More information about the llvm-dev mailing list