digitalmars.D.ldc - LDC LTO proper flags
- Sergey (15/15) Oct 13 2023 Based on experience on Debian
- kinke (9/21) Oct 13 2023 It's not required for the official prebuilt packages, as they
- whileclove (9/24) Nov 29 2023 The issue mentioned in the Debian Bug report you provided
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?
Oct 13 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#L114For 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.
Oct 13 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
Nov 29 2023