[llvm-dev] (Thin)LTO llvm build

Carsten Mattner via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 16 16:46:14 PDT 2016


On Sat, Sep 17, 2016 at 12:48 AM, Teresa Johnson <tejohnson at google.com> wrote:
>
> On Fri, Sep 16, 2016 at 2:54 PM, Carsten Mattner via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> On Fri, Sep 16, 2016 at 11:28 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>>
>> > You probably missed -DLLVM_BINUTILS_INCDIR.
>> >
>> > See: http://llvm.org/docs/GoldPlugin.html
>>
>> plugin-api.h is in /usr/include, so I'd expect it to be found, but I
>> can explicitly set BINUTILS_INCDIR and re-bootstrap with gcc 6.2.1.
>>
>> I have ld.gold, but I'm not sure if /usr/bin/ld uses it, though I'd expect
>> it to since it's been in for a couple releases now.
>>
>> $ ld -v
>> GNU ld (GNU Binutils) 2.27
>> $ ld.bfd -v
>> GNU ld (GNU Binutils) 2.27
>> $ ld.gold -v
>> GNU gold (GNU Binutils 2.27) 1.12
>
>
> Looks like your default ld is GNU ld.bfd not ld.gold. You can either change your
> /usr/bin/ld (which probably is a link to /usr/bin/ld.bfd) to point instead to
> /usr/bin/ld.gold, or if you prefer, set your PATH before the stage1 compile to a
> location that has ld linked to ld.gold.

I can look into and check why Arch Linux has it configured like that.

In the meantime, Mehdi's suggestion to explicitly pass BINUTILS_INCDIR
restored the previous configure behavior, and the new llvm build has
lib/LLVMgold.so. Thanks to both of you for pointing out the missing cmake
flag.

I've checked the configure step and it didn't fail as it did before, but before
I try to build in ThinLTO mode: since the configure step checks for the gold
plugin, is it safe to assume that I don't have to change the default system
ld to gold and ThinLTO will work, or is that a build requirement for
bootstrapping llvm in ThinLTO mode?


More information about the llvm-dev mailing list