[llvm-dev] (Thin)LTO llvm build

Xinliang David Li via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 3 17:22:42 PDT 2016


For clang build, cmake flags:

 -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold \
 -DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=gold \
 -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=gold \

David


On Mon, Oct 3, 2016 at 5:04 PM, Carsten Mattner via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161003/af6b2836/attachment.html>


More information about the llvm-dev mailing list