Linux LTO with lld from llvm 9

kinke noone at
Thu Oct 10 18:53:22 UTC 2019

On Thursday, 10 October 2019 at 08:44:32 UTC, Newbie2019 wrote:
> On Friday, 4 October 2019 at 09:54:44 UTC, kinke wrote:
>> The problem here is that the produced bitcode is v9, but the 
>> gold plugin is from LLVM v8.0.1. LDC v1.18.0-beta2 features 
>> the v9 gold plugin; it'll probably also work when updating 
>> your clang to v9.
> Thanks for the explain.  I add `-gcc=clang -linker=lld 
> --plugin=/opt/build/llvm/build/lib/ 
> --flto-binary=/opt/build/llvm/build/lib/` to ldc,  but 
> ldc2 not pass into clang,  and the ld.lld still run 
> with  `-plugin /usr/bin/../lib/`.  how could I use 
> the new builded instead ?

Since v1.17, LDC doesn't specify the plugin anymore when linking 
with LLD, as it shouldn't need it. So looks like your clang is 
adding a plugin path. You can explicitly add it with 
`-L-plugin=/opt/build/llvm/build/lib/` (`-plugin` is for 
LLVM/clang plugins) in the LDC cmdline (and make sure to specify 
`-flto=<thin|full>`). If you don't succeed, try with 
`-linker=gold`, where the plugin path is added by LDC 

More information about the digitalmars-d-ldc mailing list