Linker Options

Options for linking.

-h [system|default]_alloc

Default: -h default_alloc

By default, the compiler uses a modified malloc implementation that offers better support for memory needs. The -h system_alloc option directs the compiler to link in the native malloc provided by the OS instead of the modified implementation.

-h dynamic

The -h dynamic option directs the compiler driver to link dynamic libraries at run time. This option is used to create dynamically linked executable files and may not be used with the -h static or -h shared options. Note that the preferred invocation is to call the generic ftn command with the -dynamic option, rather than using this compiler specific option. See the ftn(1) man page.

-h [no]pgas_runtime

Default: pgas_runtime

The -h pgas_runtime option directs the compiler driver to link with the runtime libraries required when linking programs that use UPC, or coarrays. In general, a resource manager job launcher such as aprun or srun must be used to launch the resulting executable.

The -hnopgas_runtime option prevents this runtime library environment from being added to the link line.

Use the -hnopgas_runtime option with a program that does not use UPC or coarrays, when it needs to be executed outside of the aprun/srun job launch context. For example, to test a serial program which does not contain any UPC or coarray code on a login or service node, or fork/exec an executable on a compute node. Also, compile non-coarray Fortran using the -hnocaf option.

-h pgas_runtime is not supported in the Envoy environment.

-h shared

The -h shared option creates a library which may be dynamically linked at run time. Note that the preferred invocation is to call the generic ftn command with the -shared option, rather than using this compiler specific option. See the ftn(1) man page.

-h static

The -h static option directs the linker to use the static, rather than the dynamic, version of the libraries to create an executable file. Note that the preferred invocation is to call the generic ftn command with the -static option. See the ftn(1) man page.

-l libname

The -l libname option directs the compiler driver to search for the specified object library file when linking an executable file. To request more than one library file, specify multiple -l options.

When statically linking, the compiler driver searches for libraries by prepending ldir/lib to libname and appending .a, for each ldir that has been specified by using the -L option. It uses the first file it finds.

When dynamically linking, the library search process is similar to the static case, with a few differences. The compiler driver searches for libraries by prepending ldir/lib on the front of libname and appending .so on the end of it, for each ldir that has been specified by using the -L option. If a matching .so is not found, the compiler driver replaces .so with .a and repeats the process from the beginning. It uses the first file it finds.

There is no search order dependency for libraries.

If personal libraries are specified by using the -l command line option, those libraries are added before the default CCE library list. The -l option is passed to the linker. For example, when the following command line is issued, the linker looks for a library named libmylib.a and adds it to the top of the list of default libraries.

ftn -l mylib target.f

-L ldir

Changes the -l option search algorithm to look for library files in directory ldir during link time. To request more than one library directory, specify multiple -L options.

The linker searches for library files in the compiler release-specific directories.

Multiple -L options are treated cumulatively as if all ldir arguments appeared on one -L option preceding all -l options. Therefore, do not attempt to link functions of the same name from different libraries through the use of alternating -L and -l options.

-h byteswapio

Forces byte-swapping of all input and output files for direct and sequential unformatted I/O. Byteswapio is implemented during the linker phase so that it can be uniformly applied across the entire executable.