LTO for shared libs?

David Brown david@westcontrol.com
Tue Feb 7 14:40:00 GMT 2012


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.





More information about the Gcc-help mailing list