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
linkonce-mistype.patch (4.86 KB)