I have a set of static libraries, say lib1.a, lib2.a and lib3.a which have been compiled using ICC (Intel C/C++ Compiler). I used ICC with -ipo -c for compilation to create .o files and then XIAR (Intel Archiver) for creating .a libraries.
I want to give these three libraries to a client who does not have ICC and hence will be using GCC to compile and link her application with these libraries. Will the speed-gain (expected from cross-file optimizations due to libs built with -ipo option) not be achieved at all if she links these libraries using GCC?
This page from Intel Website 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.
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.
Any help will be appreciated.
GCC uses a separate linker program (called ld.exe ) to perform the linking.
A static library is basically a set of object files that were copied into a single file. This single file is the static library. The static file is created with the archiver (ar). First, calc_mean.c is turned into an object file: gcc -c calc_mean.c -o calc_mean.o.
If you using -ipo the optimization will actually happen at the link stage.
During compilation (icc -c -ipo) the Intel compiler only stores additional information in the object files. This additional information is used at link stage to do the actual interprocedural optimization (ipo).
So in order to benefit from IPO you need to use the Intel compiler at compile and link stage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With