[llvm-dev] CMake option to disable LTO?

2,027 views
Skip to first unread message

Steve King via llvm-dev

unread,
Jan 13, 2016, 2:21:41 PM1/13/16
to llvm-dev
Hello LLVM,
When building LLVM/Clang (debug build), linking takes too long. I
notice that LTO is enabled now and guess that's to blame. Is there a
CMAKE config option to disable LTO linking? I can't seem to find
anything.

Thanks,
-steve
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Mehdi Amini via llvm-dev

unread,
Jan 13, 2016, 2:26:14 PM1/13/16
to Steve King, llvm-dev
Hi,

There is no option (that I know of) to enable/disable LTO (it shouldn’t be enabled) other than setting it explicitly in the CMAKE_C_FLAG/CMAKE_CXX_FLAG.

Are you sure LTO is enabled? What it the value of CMAKE_C_FLAG/CMAKE_CXX_FLAG in your CMakeCache.txt?


Mehdi

Steve King via llvm-dev

unread,
Jan 13, 2016, 6:05:46 PM1/13/16
to Mehdi Amini, llvm-dev
On Wed, Jan 13, 2016 at 11:26 AM, Mehdi Amini <mehdi...@apple.com> wrote:
> Are you sure LTO is enabled? What it the value of CMAKE_C_FLAG/CMAKE_CXX_FLAG in your CMakeCache.txt?

Thanks Mehdi, I think I'm mistaken about LTO. During linking, my gcc
5.3 loads liblto_plugin.so and lto_wrapper and so on, but I don't see
the -flto option to actually enable it. Must be something else
clogging my build.

Duncan P. N. Exon Smith via llvm-dev

unread,
Jan 25, 2016, 12:19:26 PM1/25/16
to Steve King, llvm-dev
I think it'd be a bug if you got LTO by default with a debug build.
What platform are you on? What cmake command did you use when
configuring?

Rafael Espíndola

unread,
Jan 26, 2016, 7:42:42 AM1/26/16
to Duncan P. N. Exon Smith, llvm-dev
On 25 January 2016 at 09:19, Duncan P. N. Exon Smith via llvm-dev

<llvm...@lists.llvm.org> wrote:
> I think it'd be a bug if you got LTO by default with a debug build.
> What platform are you on? What cmake command did you use when
> configuring?

It is probably just an oddity of building with current gcc:


--------------------------------
gcc test.o -o test.so -shared -Wl,-debug
.....
usr/bin/ld -plugin
/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/liblto_plugin.so...
----------------------------

It always passes the plugin options to ld, even when not doing LTO.

Cheers,
Rafael

Reply all
Reply to author
Forward
0 new messages