Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28457 Discussions

some symbols with __imp_ prefix loaded while many others discarded while creating executable.

Kunal_Rao
Novice
435 Views
Hi
I have created an executable linking the msmpi library and hdf5 library with the code compiled and linked with Intel compilers. ( I am using the cygwin environment )
I have included -libs:dll as one of the options while compiling and linking and linked with -verbose option (for Microsoft linker).
My command while linking is:
$ifort -libs:dll -o flash3 *.o -link -nodefaultlib:LIBCMT -verbose msmpi.lib msmpifec.lib msmpifmc.lib libhdf5.lib |tee linking.log
Note: I have already created alias for ifort:
$ alias ifort='ifort -Qlocation,link,"$VCINSTALLDIR/bin"'
so it is using Microsoft linker.
The paths to msmpi and HDF5 library is mentioned in the LIB env. variable. The linking goes fine and the executable is created, but some of the symbols with __imp_ prefix are loaded while many others are discarded.
I wanted to know why those are discarded and how do I include all the symbols with __imp_ prefix. I am attaching the linking.log file which was created for your reference. In that file you can see that some are loaded while many others are discarded (pg. 79/242). (those with __imp_ symbol prefix)
Can you please check and let me know. How do I include all the symbols with __imp_ prefix and not discard any of them.
Thanks & Regards,
Kunal
0 Kudos
4 Replies
mecej4
Honored Contributor III
435 Views
It is the normal behavior of a linker to pull in only those symbols that are referenced. Were that not so, a simple "Hello World" program woule result in a .EXE file bigger than the sum of the sizes of all the libraries searched to create the .EXE file. This could easily bloat what is now a 6K file to a 6M file; every application created by the compiler would contain all the contents of the libraries, etc.

In fact, some linkers claim "smartness" on the basis of being able to discard symbols from .OBJ files that are not needed.

Perhaps you should explain what you are trying to accomplish before asking for non-standard linker behavior.
0 Kudos
Kunal_Rao
Novice
435 Views
I have compiled the same source code with PGI compilers and Intel compilers and linked with MSMPI library and HDF5 library. In the executable that the PGI compiler creates, there are many symbols/functions included which were discarded when I used Intel compilers.
My application works fine with single process and multi-process environmentwhen I use the executable that PGI compilers created . But when I am using the executable created by the Intel compilers, it runs only with single process but crashes with multi-process.
So, I checked in both these executables which functions are included and as an example picked the one's included from the msmpi.dll using:
$dumpbin.exe /IMPORTS:msmpi.dll flash3.exe |tee imports_msmpi_pgi.log (for PGI compiled executable)
$dumpbin.exe /IMPORTS:msmpi.dll flash3.exe |tee imports_msmpi_intel.log (for Intel compiled executable)
I notice that the executable compiled with PGI has lot more functions included than the executable compiled with Intel compilers. My guess is perhaps, because of this my application crashes with multi-process.
That is why, I was wondering, why is Intel compiler discarding those functions, where as PGI compilers have included them.
I am attaching both the files imports_msmpi_pgi.log and imports_msmpi_intel.log for your reference. Also, if you look back in the previously attached linking.log file, you will notice that the functions which PGI compiler has included, are actually being discarded by the Intel compilers. Note, that the source code is the same. So I was wondering why do I see this difference and how do I resolve it.
Thanks & Regards,
Kunal
0 Kudos
mecej4
Honored Contributor III
435 Views
It is probably not too much effort to test your conjecture.

Take the entry point MPI_File_read, for example. If, you load the PGI generated .EXE file in your parallel debugger and set a break point at MPI_File_read, and run your program in multi-thread/process mode. If that break point is never hit, as I suspect, you will know that your conjecture is wrong and that the real reasons are elsewhere.

You can also see if any instruction has a reference to the 'unnecessary' entries such as MPI_File_read. You may ask at the PGI user forum about why their linker (which is essentially the same MS linker that Intel uses) includes unreferenced symbols.
0 Kudos
Kunal_Rao
Novice
435 Views
okay, Thanks !! I will check !!
Regards,
Kunal
0 Kudos
Reply