LDC LTO proper flags

whileclove whileclove at gmail.com
Wed Nov 29 09:09:44 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?
>
> 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.
>
> But is "-flto-binary" is still required? What is it used for?
>
> Can we please improve some information about proper flags usage 
> for LTO enabled code in LDC?

The issue mentioned in the Debian Bug report you provided 
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=960157) seems 
specific to the Debian distribution and the LDC (LLVM D Compiler) 
package in that context. The bug report highlights that the 
-flto-binary flag needs to be manually specified to locate the 
LLVMgold.so plugin, which is required for Link Time Optimization 
(LTO) in LDC.
https://snake-game.io


More information about the digitalmars-d-ldc mailing list