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

Possible Loader Bug for MacOSX

John_G_8
Beginner
262 Views

I work with a very large code with many developers. Recently one of my fellow developers added a Fortran module that contained only data, no functions or subroutines. The data was used in another Fortran module. The library in question was loaded into an archive library using xiar. When the executable file was created using static loading the global data from the module with no subroutines was not resolved. This was because the symbols from the object file created by compiling the module in question were not recognized as being needed by the archive loader. This problem occurred for Intel Fortran and Intel C/C++ version 16.0.3. My code is a mixed C++/C/Fortran code and was linked using C++.  We worked around this linker problem by adding a dummy subroutine and calling it from outside the module in question. This made the linker load the object module with the data we needed. We also checked for this situation on a Linux system with 16.0.3 and did not see this problem. Basically the loader is not recognizing global variable symbols as being sufficient to load an object from an archive library. We also noted that  explicitly adding the object file in question to the load line also enabled the missing symbols to be resolved. My best guess is that is a bug (feature?) caused by an interaction of the Intel compiler and the MacOSX system (I use OSX 10.11.6 with Xcode 7.3.1). A final note, is that when I did a build using GCC 6.1 (gcc, g++, gfortran) this problem did not occur and the load correctly resolved the needed symbols.

0 Kudos
1 Reply
Kevin_D_Intel
Employee
262 Views

Thank you for the detailed description. I don't recall our hearing of this before so this may be a use case we're not aware of yet. I will try creating a reproducer from your details.

 

0 Kudos
Reply