Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Support for 64-bit Architecture on Linux

Applications designed to take advantage of Intel® 64 architecture can be built with one of three memory models:

  • small (-mcmodel=small)

    This causes code and data to be restricted to the first 2GB of address space so that all accesses of code and data can be done with Instruction Pointer (IP)-relative addressing.

  • medium (-mcmodel=medium)

    This causes code to be restricted to the first 2GB; however, there is no restriction on data. Code can be addressed with IP-relative addressing, but access of data must use absolute addressing.

  • large (-mcmodel=large)

    There are no restrictions on code or data; access to both code and data uses absolute addressing.

IP-relative addressing requires only 32-bits, whereas absolute addressing requires 64-bits. This difference can affect code size and performance. (IP-relative addressing is somewhat faster.)

Additional Notes on Memory Models and Large Data Objects

  • When you specify option -mcmodel=medium or -mcmodel=large, it sets option -shared-intel. This ensures that the correct dynamic versions of the Intel runtime libraries are used.
  • When you build shared objects (.so), Position-Independent Code (PIC) is specified (that is, -fpic is added by the compiler driver) so that a single .so can support all three memory models. However, code that is to be placed in a static library, or linked statically, must be built with the proper memory model specified. Note that there is a performance impact to specifying the medium or large memory models.

  • The use of the memory model (medium, large) option and the -shared-intel option is required as a by-product of the code models stipulated in the 64-bit Application Binary Interface (ABI), which is written specifically for processors with the 64-bit memory extensions. Both the compiler and the GNU linker (ld) are responsible for generating the proper code and necessary relocations on this platform according to the chosen memory model.

  • The 2GB restriction on Intel® 64 architecture involves not only arrays greater than 2GB, but also COMMON blocks and local data with a total size greater than 2GB. The Compiler Options reference contains additional discussion of the supported memory models and offers details about the 2GB restrictions for each model (see the description for option mcmodel).

  • If, during linking, you fail to use the appropriate memory model and dynamic library options, an error message in this format occurs:

<some lib.a library>(some .o): In Function <function>:
  : relocation truncated to fit: R_X86_64_PC32 <some symbol>