Intel® Fortran Compiler 16.0 User and Reference Guide

Understanding Code Layout and Multi-Object IPO

One of the optimizations performed during an IPO compilation is code layout. The analysis performed by the compiler during multi-file IPO determines a layout order for all of the routines for which it has intermediate representation (IR) information. For a multi-object IPO compilation, the compiler must tell the linker about the desired order.

If you are generating an executable in the link step, the compiler does all of this automatically. However, if you are generating object files instead of an executable, the compiler generates a layout script, which contains the correct information needed to optimally link the executable when you are ready to create it.

This linking tool script must be taken into account if you use either the [Q]ipo-c or [Q]ipo-S compiler option. With these options, the IPO compilation and actual linking are done by different invocations of the compiler. When this occurs, the compiler issues a message indicating that it is generating an explicit linker script, ipo_layout.script.

The Windows linker (link.exe) automatically collates these sections lexigraphically in the desired order.

The compiler first puts each routine in a named text section that varies depending on the operating system:

Windows:

Linux:

When ipo_layout.script is generated, you should modify your link command if you want to use the script to optimize code layout:

Example

--script=ipo_layout.script

If your application already requires a custom linker script, you can place the necessary contents of ipo_layout.script in your script.

The layout-specific content of ipo_layout.script is at the beginning of the description of the .text section. For example, to describe the layout order for 12 routines:

Example output

.text     :
{
*(.text00001) *(.text00002) *(.text00003) *(.text00004) *(.text00005)
*(.text00006) *(.text00007) *(.text00008) *(.text00009) *(.text00010)
*(.text00011) *(.text00012)
...

For applications that already require a linker script, you can add this section of the .text section description to the customized linker script. If you add these lines to your linker script, it is desirable to add additional entries to account for future development.

If you choose to not use the linker script your application will still build, but the layout order will be random. This may have an adverse affect on application performance, particularly for large applications.

See Also