Enabling LTO for target libraries (e.g., libgo, libstdc++)

Allan Sandfeld Jensen linux@carewolf.com
Fri Jan 25 18:30:00 GMT 2019


On Freitag, 25. Januar 2019 07:22:36 CET Nikhil Benesch wrote:
> Does anyone have advice to offer? Has anyone tried convincing the build
> system to compile some of the other target libraries (like libstdc++ or
> libgfortran) with -flto?
> 
Make sure the static versions of the libraries are partially linked before 
being archived so they do not have LTO code in the final libraries.

gcc -r <objectfiles> -o libname.o
ar x libname.a libname.o

Never done it with gcc libraries though.

'Allan




More information about the Gcc mailing list