[LLVMdev] Unexpected behaviour of the LLVM gold plugin with --allow-multiple-definition

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Oct 18 12:39:07 PDT 2013


> As it can be seen from the output, get_unit_id is chosen correctly from the
> first unit*.c file specified in the input arguments.
> However, the symbol only_in_unitX, where unitX is the second specified unit
> file, is undefined. In general, it seems that whenever a file has a symbol
> which was overridden, all symbols from the file are ignored and not linked
> into the output file.

Hi Milan,

What was going on is that the gold plugin was ignoring errors from the
IR linker and continuing with a broken module. I have fixed that in
r192996 and gold should now report an error.

> Is this an intended behaviour or I am misusing the commands and/or options?
> Please let me now if there is any workaround (e.g. script for the GNU gold
> linker) so that I can get the same outcome as in the case without
> --emit-llvm.

To implement this we need two things:

* The ir linker itself needs to get a --allow-multiple-definition
option.That is, llvm-link of unit1 and unit2 should work if given that
option.
* We need to extend the gold api so that the plugin (and therefore
llvm) knows that  --allow-multiple-definition is in effect.

Cheers,
Rafael



More information about the llvm-dev mailing list