LDC LTO proper flags
kinke
noone at nowhere.com
Fri Oct 13 12:16:53 UTC 2023
On Friday, 13 October 2023 at 09:37:49 UTC, Sergey wrote:
> Based on experience on Debian
> (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960157)
> Docker image I found I was required to use
> "-flto-binary=/usr/lib/LLVMgold.so" in addition to "-flto=full".
>
> Is it Debian specific issue or required for other distributions
> as well?
It's not required for the official prebuilt packages, as they
bundle the plugin directly. `/usr/lib/LLVMgold.so` is in the
default search path, so should be found automatically, unless
Debian have patched this:
https://github.com/ldc-developers/ldc/blob/60e45d619a00e32f79976c9e0047a7828d47c1ea/driver/linker-gcc.cpp#L114
> For example on Archlinux the liblphobos package provides two
> files:
> - usr/lib/libdruntime-ldc-lto.a
> - usr/lib/libphobos2-ldc-lto.a
>
> So probably adding
> "-defaultlib=phobos2-ldc-lto,druntime-ldc-lto" will be fine.
This is a separate thing, to be used explicitly when wanting to
LTO druntime and Phobos too, not just your code. It implies that
these libs are linked statically then.
More information about the digitalmars-d-ldc
mailing list