Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

IPO: Linking libraries built with ICC with application built with GCC

$
0
0

I am using icc version 13.1.0 (gcc version 4.6.0 compatibility) with gcc version 4.6.3 on Ubuntu 12.04.2.

I have a set of static libraries, say lib1.alib2.a and lib3.a which have been compiled using ICC. I  used ICC with -ipo -c for compilation to create .o files and then XIAR for creating .a libraries. 

I want to give these three libraries to a customer who does not have ICC and hence will be using GCC to link his application with these libraries. Will the speed-gain (expected from -ipo built libraries) not be achieved at all if she links these libraries using GCC?

This page on "GCC* Compatibility and Interoperability" states:

"Link-time optimization using the -ffat-lto-objects compiler option is provided for gcc* compatibility. This implies that ld and ar can be used to link and archive object files, but by doing so you will lose cross-file optimizations."

Further, if case the speed-gains are supposed to get lost with linking with GCC, then if I change my setup some thing like this;

lib1.alib2.alib3.a and a wrapper source file wrapper.c

All the references made by my customer's application are exclusively present in wrapper.c. And then I executed this command:

xild -o plugin.a wrapper.o lib1.a lib2.a lib3.a -r -static

Now if any linking is taking place, then I expected the size of plugin.a to be considerably smaller then the combined size of [wrapper.o + lib1.a + lib2.a + lib3.a]. As I understand my libraries had extra files for Intermediate Representation (.ilo files) which take more memory than real object files. And if cross-file optimizations had happened, then such files would have been discarded after use. But the size of plugin.a remains the same as the sum of the size my libraries, implying the cross-file optimizations did not take place.

Is there any way to get the benefit of -ipo flag as much as possible without the customer having to use ICC for his application?

Any help will be appreciated. Apologies for such long query.


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>