Linker

From VSI OpenVMS Wiki
Jump to: navigation, search

Linker is a program used to create images. It is invoked by the LINK command.

Functions

  • Symbol resolution: source modules may reference symbols defined externally to the module, and the linker finds their definitions in the files specified and substitutes the value of the symbol for the reference to the symbol.
  • Virtual memory allocation: the linker allocates virtual memory for the image, based on the memory requirements specified by the input files
  • Image initialization: the linker initializes the image by filling it with the compiled binary data and code. The linker also inserts the actual value of resolved symbols at each instance where the symbol is referenced.
  • Image optimization: for OpenVMS Alpha images, the linker can perform certain optimizations to improve the run-time performance of the image it is creating. These optimizations include replacing JSR instruction sequences with the more efficient Branch to Subroutine (BSR) instruction sequence wherever the language processors specify. For OpenVMS I64 images, the linker can optimize data references to the short data segment.

Input Files

File Default Type Description
Object file .OBJ Created by a language processor. May be specified on the LINK command line or in a linker options file. This is the default input file accepted by the linker.
Shareable image .EXE Produced by a previous link operation. Must be specified in a linker options file; you cannot specify a shareable image as an input file on the command line. Identify the input file as a shareable image by appending the /SHAREABLE qualifier to the file specification.
Library file .OLB Produced by the Librarian utility. May contain object modules or shareable images. May be specified on the LINK command line, in a linker options file, or as a default user library processed by the linker. Identified by the /LIBRARY or /INCLUDE qualifiers.
Symbol table file .STB Produced by a previous link operation or a language processor. May be specified on the LINK command line or in an options file. Because a symbol table file is processed as an object module, it requires no identifying qualifier.
Options file .OPT Text file containing link option specifications or link input file specifications. May be specified only on the command line; you cannot specify an options file inside another options file. Identify the input file as an options file by appending the /OPTIONS qualifier to the end of the file specification.

Output Files

File Default Type Description
Executable image .EXE A program that can be run at the command line. This image is the default output file created by the linker. Specify the /EXECUTABLE qualifier to create an executable image.
Shareable image .EXE A collection of procedures and data that usually can be referenced after being included in a link operation in which another image is created. Specify the /SHAREABLE qualifier to create a shareable image.
System image .EXE A program that is meant to be run as a standalone system. Specify the /SYSTEM qualifier to create a system image.
Symbol table file .STB An object module containing the global symbol table from an executable or system image, or the universal symbol table from a shareable image. Specify the /SYMBOL_TABLE qualifier to create a symbol table file.
Map file .MAP A text file created by the linker that provides information about the layout of the image and statistics about the link operation. Specify the /MAP qualifier to create a map file.
Debug symbol file (64-bit specific) .DSF A file containing debug information for use by the OpenVMS Debugger or System Code Debugger. Specify the /DSF qualifier to create a debug symbol file.