Link Time Optimization Bitcode File Format

IGotD- nise at
Tue Oct 6 17:33:50 UTC 2020

On Tuesday, 6 October 2020 at 16:46:28 UTC, Severin Teona wrote:
> Hi all,
> I am trying to build the druntime with the 'ldc-build-runtime' 
> tool for microcontrollers (using the arm-none-eabi-gcc 
> compiler) and therefore the size of the druntime should be as 
> little as possible. One solution I had was to use Link Time 
> Optimization (LTO) to reduce the size.
> The problem now is the fact that when I compile the druntime 
> with -flto=full or -flto=thin (as arguments for LDC2), the 
> resulted object files (and also a big part of the runtime as it 
> is a static library) have a different file format - LLVM IR 
> bitcode - than I need, which is ELF 32-bit. Also, when I try to 
> link the druntime with the application I want to write on the 
> microcontroller, there are some link errors due to the file 
> format.
> I also tried using a different archiver - llvm-ar - but I had 
> no luck.
> Could you give me some advice about how should I fix this?
> Thank you!

I have run into the same problem when using GNU ld. The problem 
is that my version of GNU ld, version (which is 
ancient) cannot deal with the object file format when LTO is 
enabled. One way is to try llvm-ld and see if that one can handle 

More information about the Digitalmars-d-learn mailing list