COFF link editor

COFF link editor

This chapter describes the link editor, ld(CP). It is organized as follows:

ld creates a program by combining object files, performing relocations, and resolving external symbols. The input files are normally relocatable object files, or library files containing relocatable object files which have been created by cc(CP) or by previous invocations of ld. The output file created by ld may be a relocatable object file or an absolute (executable) object file.

Two object file formats, COFF (Common Object File Format) and ELF (Executable and Linking Format), are supported by this release of the link editor. The command language supported by the COFF version of ld allows the user a greater degree of control over object files and their memory locations. A similar facility, the mapfile option, is provided for the ELF linker. See ``Mapfile option'' for details on how to change the default mapping provided by the ELF linker.

If a particular file format is not explicitly specified through the -b option, ld scans all the user specified object files and user provided libraries (if any) that are to be linked. It determines whether an object file is in COFF or ELF format and executes the appropriate binaries in each case. See the ld(CP) man page for more information.

The discussion that follows relies heavily on the reader's knowledge of the COFF file format. In particular, familiarity with the concept of a section is essential to understanding this material. See ``Common Object File Format (COFF)'' for a general discussion of the file format.

NOTE: Although the basic concepts are similar, the ELF file format is different from the COFF file format. The command language for the COFF linker is also different from the mapfile directives used for the ELF linker. Most of the examples provided here do not apply to ELF binaries. See ``ELF object files'' and ``Mapfile option'' for general discussion of the ELF file format and how to write mapfiles for the ELF link editor.

Next topic: Sections

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003