David Brown wrote: > On 07/02/2012 13:50, Neal Becker wrote: >> Can LTO be used to build shared libs? >> >> Would it be useful? >> > > I expect you can use LTO when building shared libs, just like building > anything else. It could well be useful, as the library typically will > have lots of internal functions that can be optimised with LTO. > > Obviously functions exported from the shared lib will not be optimised > into the caller code, since that linking is done at link-load time. So > there is no point in having LTO information within the shared lib. > > With static libraries, I believe you can have LTO information in the > libraries, and that will be used at link time for programs using the > static libraries. Well I tried it and on my sample of exactly 1 test, my code ran somewhat slower with LTO.