Boost logo

Boost :

Subject: [boost] clang-win, (Thin)LTO this time
From: degski (degski_at_[hidden])
Date: 2018-10-31 14:04:53


Starting new thread.

Substantial progress has been made towards the goal of compiling Boost with
Clang/LLVM (clang-cl.exe, targeting MSVC). The latest PR in this respect by
Peter has achieved this.

The next step is to be also able to use lld (lld-link in case of
clang-cl.exe targeting MSVC) to generate the Boost-libs (static/dynamic).

The main interest, IMO, is to be able to use LTO (Thin or Full), which is
not possible without the use of LLD. A secondary benefit appears to be
faster link times (info from the lld manual).

In order to build static ThinLTO-enabled libs, it suffices to pass
<compileflags>-flto=thin in the project jam file. The archiving, though,
needs to be done with lld-link.exe, passing /lib as the first option (this
way it will act as lib.exe, while being able to handle the llvm-byte-code
[lib.exe finds the so generated .obj-files to be corrupt]). At consumption
time of the libs, lld-link needs to be used for linking.

Hacking clang-win.jam:156 to:

toolset.flags clang-win.archive .LD $(cond) : "\"C:\\Program
Files\\LLVM\\bin\\lld-link.exe\"" /lib ;

achieves this goal.

I would like to ask (probably Peter) to have a look into whether this can
be achieved "the proper way", i.e. to programmatically set that particular
line to the required value for this use-case.

degski

-- 
*“If something cannot go on forever, it will stop" - Herbert Stein*

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk