[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: link-time optimization

From: Török Edwin
Subject: Re: link-time optimization
Date: Sun, 04 Apr 2010 19:03:35 +0300
User-agent: Mozilla-Thunderbird (X11/20091109)

On 04/04/2010 11:54 AM, Ralf Wildenhues wrote:
> * Ralf Wildenhues wrote on Sun, Mar 28, 2010 at 05:33:44PM CEST:
>> I'm still working on a patch to support -flto in libtool, it needs
>> changes in several places.
> I have a preliminary(!) patch set here for LTO support in libtool.


Thanks a lot for the patches, they worked fine so far!

I'd have one more request: please add "-use-gold-plugin" to the list of
flags passed through to support LLVM's LTO described here:

I've applied your patches, re-autoconfed ClamAV, and tested a GCC build
with -flto: ./configure CFLAGS="-flto -O2" CXXFLAGS="-flto -O2"
CC=gcc-4.5 CXX=g++-4.5

Everything worked fine, and make check passed too!
(Now of course it didn't LTO the entire program because
-fuse-linker-plugin triggers PR41584)

If I edit libtool and add -use-gold-plugin (after -fuse-linker-plugin),
then I can build ClamAV with llvm2.7[*] without using the workarounds
described on that page, by simply doing this:

CFLAGS="-O4 -use-gold-plugin" CXXFLAGS="-O4 -use-gold-plugin"

This worked too (with less optimizations):
CFLAGS="-flto -use-gold-plugin" CXXFLAGS="-flto -use-gold-plugin"

I also had to add a symlink to system's (the llvm-gcc
binary ships with a, and a libstdc++.a which break linking
LTO programs, because they are not PIC).

[*] After copying as described in

> DO NOT submit this to your favorite distribution, it is not ready
> for general consumption yet.
> Several upstream issues to fix here:
> - gold bug
>   (common symbols not emitted with -fuse-linker-plugin)
> - GCC bug
>   (ICE w/ partial linking)
> - GCC bug
>   (segfault if __gnu_lto_v1 is referenced)
> - gold bug
>   (names in linker scripts in subdirs are relative to subdir)
> - GCC bug
>   (-fwhopr ICE with TU that contains no function)

Yep, I'm hitting this one, so I can't test -fuse-linker-plugin.

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]