ld_ocs(1) (Object Compatibility Standard) ld_ocs(1)
NAME
ld (ocs) - OCS-compliant link editor for object files
SYNOPSIS
ld [ options ] filename
DESCRIPTION
The Object Compatibility Standard (OCS) compliant ld command allows
one to create an executable Binary Compatibility Standard (BCS)
compliant binary from a set of OCS-compliant, COFF objects.
Invocation of this ld causes linking to occur within an environment
completely separate from the standard ELF linking envirnment. The
OCS linking environment does not support linking of ELF objects or
use ELF libraries. The OCS-compliant ld is located in /usr/ocs/bin
and looks for its libraries in /usr/ocs/lib, the default location for
the OCS-compliant libraries. The output of ld is left in a.out. By
default this file is executable if no errors occurred during the load
and the -r option is not specified. If any input file, filename, is
not an object file, ld assumes it is either an archive library or a
text file containing link editor directives. (See the Programmer's
Guide: ANSI C and Programming Support Tools for a discussion of input
directives.)
If any argument is a library, it is searched exactly once at the
point it is encountered in the argument list. Only those routines
defining an unresolved external reference are loaded. The library
(archive) symbol table (see ar(4)) is searched sequentially with as
many passes as are necessary to resolve external references which can
be satisfied by library members. Thus, the ordering of library
members is functionally unimportant, unless there exist multiple
library members defining the same external symbol.
The following options are recognized by ld:
-e epsym
Set the default entry point address for the output file to be that
of the symbol epsym.
-f fill
Set the default fill pattern for ``holes'' within an output section
as well as initialized bss sections. The argument fill is a 2-byte
constant.
-lx
Search a library libx.a, where x is up to nine characters. A
library is searched when its name is encountered, so the placement
of a -l is significant. By default, libraries are located in
/usr/ocs/lib.
7/91 Page 1
ld_ocs(1) (Object Compatibility Standard) ld_ocs(1)
-m
Produce a map or listing of the input/output sections on the
standard output.
-o outfile
Produce an output object file by the name outfile. The name of the
default object file is a.out.
-r
Retain relocation entries in the output object file. Relocation
entries must be saved if the output file is to become an input file
in a subsequent ld run. The link editor will not complain about
unresolved references, and the output file will not be executable.
-a
Create an absolute file. This is the default if the -r option is
not used. Used with the -r option, -a allocates memory for common
symbols and generates complaints about unresolved references.
-s
Strip line number entries and symbol table information from the
output object file.
-t
Turn off the warning about multiply-defined symbols that are not
the same size.
-u symname
Enter symname as an undefined symbol in the symbol table. This is
useful for loading entirely from a library, since initially the
symbol table is empty and an unresolved reference is needed to
force the loading of the first routine. The placement of this
option on the ld line is significant; it must be placed before the
library which will define the symbol.
-x
Do not preserve local symbols in the output symbol table; enter
external and static symbols only. This option saves some space in
the output file.
-z
Do not bind anything to address zero. This option will allow
runtime detection of NULL pointers.
-L dir
Change the algorithm of searching for libx.a to look in dir before
looking in /usr/ocs/lib. This option is effective only if it
precedes the -l option on the command line.
Page 2 7/91
ld_ocs(1) (Object Compatibility Standard) ld_ocs(1)
-M
Output a message for each multiply-defined external definition.
-N
Put the text section at the beginning of the text segment rather
than after all header information, and put the data section
immediately following text in the core image.
-V
Causes ld to output a message giving information about the version
of ld being used. No other processing is performed.
-VS num
Use num as a decimal version stamp identifying the a.out file that
is produced. The version stamp is stored in the optional header.
-Y[L],dir
Change the default directory used for finding libraries. If L is
specified, the first default directory that ld searches,
/usr/ocs/lib, is replaced by dir.
FILES
/usr/ocs/lib/libx.a libraries
a.out output file
SEE ALSO
as(1), cc(1), exit(2), end(3C), a.out(4), ar(4), and the Programmer's
Guide: ANSI C and Programming Support Tools.
CAVEATS
Through its options and input directives, the common link editor
gives users great flexibility; however, those who use the input
directives must assume some added responsibilities. Input directives
and options should ensure the following properties for programs: C
defines a zero pointer as NULL. A pointer to which zero has been
assigned must not point to any object. To satisfy this, users must
not place any object at virtual address zero in the program's address
space. When the link editor is called through cc(1), a startup
routine is linked with the user's program. This routine calls exit(~)
(see exit(2)) after execution of the main program. If the user calls
the link editor directly, then the user must ensure that the program
always calls exit(~) instead of falling through the end of the entry
routine.
The symbols etext, edata, and end (see end(3C)) are reserved and are
defined by the link editor. It is incorrect for a user program to
redefine them.
If the link editor does not recognize an input file as an object file
or an archive file, it will assume that it contains link editor
directives and will attempt to parse it. This will occasionally
7/91 Page 3
ld_ocs(1) (Object Compatibility Standard) ld_ocs(1)
produce an error message complaining about "syntax errors."
Arithmetic expressions may only have one forward referenced symbol
per expression.
Shared libraries are not supported.
Page 4 7/91