When function signatures don't match and the undefined function is not
called directly (i.e. only has its address taken) we don't issue a
warning or create a runtime thunk for the undefined function.
Instead in this case we simply use the defined version of the function.
This is possible since checking signatures of dynamic calls happens
at runtime so any invalid usage will still result in a runtime error.
This is needed to allow C++ programs to link without generating
warnings. Its not uncommon in C++ for vtables to be populated by
function address whee the signature of the function is not known in the
compilation unit. In this case clang delcares the method as void(void)
and relies on the vtable caller casting the data back to the correct
signature.
I'm not sure if I understand the code correctly. It seems like a bit indicating whether a symbol is called directly or not should logically belong to each Symbol object rather than a side table inside a file object, no? Let's say one file contains an undefined symbol, the other file contains a defined symbol, and the undefined symbol is called directly. If the linker merges the two symbols, the _defined_ symbol is called directly, isn't it?