Linux LTO with lld from llvm 9
kinke
noone at nowhere.com
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/libLTO.so
> --flto-binary=/opt/build/llvm/build/lib/libLTO.so` to ldc, but
> ldc2 not pass libLTO.so into clang, and the ld.lld still run
> with `-plugin /usr/bin/../lib/LLVMgold.so`. how could I use
> the new builded libLTO.so instead LLVMgold.so ?
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/libLTO.so` (`-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
automatically.
More information about the digitalmars-d-ldc
mailing list