Discussion:
lto + pgo + shared libraries : explanation ?‏
Alain Meunier
2014-07-26 09:39:18 UTC
Permalink
Hello,

gcc 4.8.2

I just happen to be in need to use pgo,lto with shared libraries that I want to link.

I cannot figure out if lto will bring some efficiency to the links.

1) gcc -march=native -03 -shared -fPIC first_shared.c -flto -o libfoo.so
2) gcc -march=native -03 -shared -fPIC second_shared.c -flto -o libbar.so

3) gcc -march=native -03 main.c -lfoo -lbar -flto


Ok all my functions are static except some of them (public interface) inside the shared library.

What should I do exactly to take advantage of lto with shared libraries ?

Now, what does it take to create PGO on shared libraries ?

I know I can use fprofile-generate/fprofile-use on 3) but will it be enough to take 1) and 2) into account ?

I am a bit lost on what to do here in this context.

All the commands work fine but is it do

Loading...