Linker control options directly accepted by the compilation system and linker options that may be passed through the compilation system to ild are described in this section.
These are linker control options accepted by the compilation system:
-i
Ignores LD_LIBRARY_PATH setting. When an LD_LIBRARY_PATH setting is in effect, this option is useful to influence the runtime library search, which interferes with the link editing being performed.
-s
Strips symbolic information from the output file. Any debugging information and associated relocation entries are removed. Except for relocatable files or shared objects, the symbol table and string table sections are also removed from the output object file.
-V
Output a message about the version of ild being used.
-B dynamic | static
Options governing library inclusion. Option -B dynamic is valid in dynamic mode only. These options can be specified any number of times on the command line as toggles: if the -B static option is given, no shared objects are accepted until -B dynamic is seen. See option -l x.
-g
The compilation systems invoke ild in place of ld when the -g option (output debugging information) is given, unless any of the following are true:
The -G option (produce a shared library) is given
The -xildoff option is present
Any source files are named on the command line
-d y | n
When -dy (the default) is specified, ild uses dynamic linking; when -dn is specified, ild uses static linking. See option -B dynamic | static.
-L path (space is optional)
Adds path to the library search directories. ild searches for libraries first in any directories specified by the -L options, and then in the standard directories. This option is useful only if it precedes the -l options to which it applies on the command line. The environment variable LD_LIBRARY_PATH or LD_LIBRARY_PATH_64 (in 64-bit link mode) can be used to supplement the library search path (see Failed Cross Reference Format).
-l x (space is optional)
Searches a library libx.so or lib.a, the conventional names for shared object and archive libraries, respectively. In dynamic mode, unless the -Bstatic option is in effect, ild searches each directory specified in the library search path for a file libx.so or libx.a. The directory search stops at the first directory containing either ild chooses the file ending in .so if -l expands to two files whose names are of the form libx.so and libx.a. If no libx.so is found, then ild accepts libx.a. In static mode, or when the -B static option is in effect, ild selects only the file ending in .a. A library is searched when its name is encountered, so the placement of -l is significant.
-o outfile
Produces an output object file named outfile. The name of the default object file is a.out.
-Q y | n
Under -Qy, an ident string is added to the .comment section of the output file to identify the version of the link editor used to create the file. This results in multiple ld idents when there have been multiple linking steps, such as when using ld -r. This is identical with the default action of the cc command. Option -Qn suppresses version identification.
path-R (space is optional)
This option gives a colon-separated list of directories that specifies library search directories to the runtime linker. If present and not null, path is recorded in the output object file and passed to the runtime linker. Multiple instances of this option are concatenated and separated by a colon.
-xildoff
Incremental linker off. Force the use of bundled ld. This is the default if -g is not being used, or -G is being used. You can override this default with -xildon.
-xildon
Incremental linker. Force the use of ild in incremental mode. This is the default if -g is being used. You can override this default with -xildoff.
-Y P,dirlist (space is optional)
(cc only) Changes the default directories used for finding libraries. Option dirlist is a colon-separated path list.
The "-z name" form is used by ild for special options. The i_ prefix to the -z options identifies those options peculiar to ild.
-z defs
Forces a fatal error if any undefined symbols remain at the end of the link. This is the default when building an executable. It is also useful when building a shared object to assure that the object is self-contained, that is, that all its symbolic references are resolved internally.
-z i_dryrun
(ild only.) Prints the list of files that would be linked by ild and exits.
-z i_full
(ild only.) Does a complete relink in incremental mode.
-z i_noincr
(ild only.) Runs ild in nonincremental mode (not recommended for customer use -- used for testing only).
-z i_quiet
(ild only) Turns off all ild relink messages.
-z i_verbose
(ild only) Expands on default information on some ild relink messages.
-z nodefs
Allows undefined symbols. This is the default when building a shared object. When used with executables, the behavior of references to such "undefined symbols" is unspecified.
-z allextract | defaultextract | weakextract
Under -z allextract, all archive members are extracted from the archive. -z defaultextract provides a means of returning to the default following use of the former extract options. A weak reference to a symbol (-z weakextract) causes a file defining that symbol to be extracted from a static library.
The following options are accepted by ild, but you must use the form:
-Wl,arg,arg (for cc), or -Qoption ld arg,arg (for others),
to pass them to ild via the compilation system
-a
In static mode only, produces an executable object file; gives errors for undefined references. This is the default behavior for static mode. Option -a cannot be used with the -r option.
-m
Produces a memory map or listing of the input/output sections on the standard output.
-t
Turn off the warning about symbols that are defined more than once and that are not the same size.
-e epsym
Sets the entry point address for the output file to be that of the symbol epsym.
-I name
When building an executable, uses name as the path name of the interpreter to be written into the program header. The default in static mode is no interpreter; in dynamic mode, the default is the name of the runtime linker, /usr/lib/ld.so.1. Either case can be overridden by -I name. The exec system call loads this interpreter when it loads the a.out and passes control to the interpreter rather than to the a.out directly.
-u symname
Enters symname as an undefined symbol in the symbol table. This is useful for loading entirely from an archive library because, 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 command line is significant; it must be placed before the library that defines the symbol.