LD(CP) XENIX System V LD(CP)
Name
ld - Invokes the link editor.
Syntax
ld [ options ] filename...
Description
ld is the XENIX link editor. It creates an executable
program by combining one or more object files and copying
the executable result to the file a.out. The filename must
name an object or library file. By convention these names
have the ``.o'' (for object) or ``.a'' (for archive library)
extensions. If more than one name is given, the names must
be separated by one or more spaces. If errors occur while
linking, ld displays an error message; the resulting a.out
file is unexecutable.
ld concatenates the contents of the given object files in
the order given in the command line. Library files in the
command line are examined only if there are unresolved
external references encountered from previous object files.
Library files must be in ranlib(CP) format, that is, the
first member must be named __.SYMDEF, which is a dictionary
for the library. ld ignores the modification dates of the
library and the __.SYMDEF entry, so if object files have
been added to the library since __.SYMDEF was created, the
link may result in an ``invalid object module.''
The library is searched iteratively to satisfy as many
references as possible and only those routines that define
unresolved external references are concatenated. Object and
library files are processed at the point they are
encountered in the argument list, so the order of files in
the command line is important. In general, all object files
should be given before library files. ld sets the entry
point of the resulting program to the beginning of the first
routine.
ld should be invoked using the cc(CP) instead of invoking it
directly. cc invokes ld as the last step of compilation,
providing all the necessary C-language support routines.
Invoking ld directly is not recommended since failure to
give command line arguments in the correct order can result
in errors.
Page 1 (printed 8/7/87)
LD(CP) XENIX System V LD(CP)
There are the following options:
-A num
Creates a standalone program whose expected load
address (in hexadecimal) is num. This option sets the
absolute flag in the header of the a.out file. Such
program files can only be executed as standalone
programs. Options -A and -F are mutually exclusive.
-B num
Sets the text selector bias to the specified
hexadecimal number.
-c num
Alters the default target CPU in the x.out header. num
can be 0, 1, 2, or 3 indicating 8086, 80186, 80286 and
80386 processors, respectively. The default on
8086/80286 systems is 0. The default on 80386 systems
is 3. Note that this option only alters the default;
if object modules containing code for a higher numbered
processor are linked, then that will take precedence
over the default.
-C
Causes the link editor to ignore the case of symbols.
-D num
Sets the data selector bias to the specified
hexadecimal number.
-F num
Sets the size of the program stack to num bytes where
num is a hexadecimal number. This option is ignored for
80386 programs which have a variable sized stack. By
default 8086 programs have a variable stack located at
the top of the first data segment, and 80286 programs
have a fixed size 4096 byte stack. The -F option is
incompatible with the -A option
-i
Creates separate instruction and data spaces for small
model programs. When the output file is executed, the
program text and data areas are allocated separate
physical segments. The text portion will be read-only
and shared by all users executing the file.
-m name
Creates a link map file named name that includes public
symbols.
Page 2 (printed 8/7/87)
LD(CP) XENIX System V LD(CP)-Mx Specifies the memory model. x can have the following
values:
s small
m middle
l large
h huge
e mixed
-n num
Truncates symbols to the length specified by num.
-N num
Sets the pagesize to hex-num (which should be a
multiple of 512) - the default is 1024 for 80386
programs. 8086/80186/80286 programs do not normally
have page-aligned x.out files and the default for these
is 0.
-o name
Sets the executable program filename to name instead of
a.out.
-P
Disables packing of segments
-r Invokes the incremental linker, /lib/ldr , with the
arguments passed to ld to produce a relocatable output
file.
-R Ensures that the relocation table is of non-zero size.
Important for 8086 compatibility.
-Rd num
Specify the data segment relocation offset (80386
only). num is hexadecimal.
-Rt num
Specify the text segment relocation offset (80386 only)
num is hexadecimal.
-s
Strips the symbol table.
-S num
Sets the maximum number of segments to num. If no
argument is given, the default is 128.
-u symbol
Designates the specified symbol as undefined.
-v num
Specifies the version number. Acceptable values for
Page 3 (printed 8/7/87)
LD(CP) XENIX System V LD(CP)
num are 2, 3, or 5; 5 is the default.
Files
/bin/ld
See Also
ar(CP), masm(CP), cc(CP), ranlib(CP)
Notes
The user must make sure that the most recent library
versions have been processed with ranlib(CP) before linking.
If this is not done, ld cannot create executable programs
using these libraries.
Page 4 (printed 8/7/87)