[llvm-dev] (Thin)LTO llvm build
Carsten Mattner via llvm-dev
llvm-dev at lists.llvm.org
Mon Oct 3 17:04:33 PDT 2016
On Mon, Oct 3, 2016 at 10:54 PM, Teresa Johnson <tejohnson at google.com> wrote:
>
> Aha - finally reproduced! The difference is using ld.bfd not
> ld.gold. With that I get the same failure (using 3.9 to build 3.9
> sources):
Thanks a lot!
[...]
> I am not sure what the official support story is for LLVMgold.so and
> ld.bfd. As mentioned earlier, the LLVM site indicates it should use
> the gold linker. Can you use that while I try to figure out whether
> this is something that should be supported/working?
I'm probably confused but I was under the impression that I am using
ld.gold due to the use of llvm-ar and llvm-ranlib and having enabled
ThinLTO, which, if not strictly required with ld.bfd >=2.26, prefers
ld.gold.
Anyway, if I extend CFLAGS and CXXFLAGS with -fuse-ld=gold, then
ld.gold terminates with
/usr/bin/ld.gold: fatal error: --plugin-opt requires --plugin
According to the manpage the compile driver, if passed -fuse-ld=gold,
will use ld.gold, so I added that to CFLAGS and CXXFLAGS before
running cmake. The above was how far I got without further insight
what I might have missed.
I also tried setting LD=ld.gold, but that wasn't really respected by
cmake, judging by how the ld actually used complained about the
unsupport -Wl options (those which you suggested for aggressive
pruning and which are not universal).
Which are:
-Wl,--gc-sections
-Wl,-plugin-opt,-function-sections
-Wl,-plugin-opt,-data-sections"
What's the right way to enable ld.gold explicitly when configuring
llvm with cmake?
More information about the llvm-dev
mailing list