[llvm-dev] llvm-link has no --allow-multiple-definition

Johannes Krupp via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 8 11:56:58 PDT 2020


Hi,

sorry for digging up this old thread, but I couldn't find a satisfactory
answer on how to use PassManagerBuilder::EP_FullLinkTimeOptimizationLast
somewhere else, so hopefully this helps anyone who stumbles accross this
thread.

> Probably you could patch the gold plugin to support something 
> similar? I haven't tried it, but I don't see any reason it couldn't 
> work. Should look similar to the lld patch I posted.  gold doesn't
> support "-mllvm", but I think you can do the same thing with
> "-plugin-opt".

Unfortunately, this doesn't work. I've tried to patch the gold-plugin to
support plugins as described (see
https://github.com/nescio007/llvm-project/commit/a1baff03ec60225fb84c2e6b0b4b98cd165b2b9f).
However, running my own passes always fails with `undefined
symbol`-errors. The reason is that the gold-plugin itself is loaded by
gold with `dlopen` but without specifying the `RTLD_GLOBAL` flag.
Therefore, llvm-specific symbols from the gold-plugin won't be visible
to llvm-passes loaded at a later stage.

> When you say it does not work with trunk at the moment - did it work
> previously? e.g. with the llvm 9 release? Or did it never work so far
> and is in the progress of being fixed?

It seems the patched lld will only be part of llvm 11 (e.g. tag
`llvmorg-11.0.0-rc2` contains the patch), but I could easily backport it
to llvm 10.0.1 as well (see
https://github.com/nescio007/llvm-project/tree/llvm-10.0.1_lld_plugins).

Best
Johannes Krupp


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5345 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200908/84f5140b/attachment.bin>


More information about the llvm-dev mailing list