The +allowunsats option still causes the linker to emit a warning message and output a.out. If you do not specify the option and the linker finds an unsatisfied symbol, the linker displays an error message and a non-executable a.out.

$ ld main.o -L. -lbar -lc

ld: Unsatisfied symbol "foo". 1 error.

Stripping Symbol Table Information from the Output File with -s and -x

The a.out file created by the linker contains symbol table, relocation, and (if debug options were specified) information used by the debugger. Such information can be used by other commands that work on a.out files, but is not actually necessary to make the file run. The ld command provides two command line options for removing such information and, thus, reducing the size of executables:

-s Strips all such information from the file. The executable becomes smaller, but difficult or impossible to use with a symbolic debugger. You can get much the same results by running the strip command on an executable (see strip(1)). In some cases, however, -srearranges the file to save more space than strip.

-x Strips only local symbols from the symbol table. It reduces executable file size with only a minimal effect on commands that work with executables. However, using this option may still make the file unusable by a symbolic debugger. These options can reduce the size of executables drastically. Note, also, that these options can also be used when generating shared libraries without affecting shareability.

Controlling Output from the Unwind Table with +strip unwind

Use the +stripunwind option to suppress output of the unwind table.

$ ld -b foo.o -o libfoo.sl +stripunwind $ elfdump -U libfoo.sl

libfoo.sl:

Using the IPF Linker with +compat or +std

In the HP-UX 11.0 release, the linker toolset supports extended features for linking in PA-64 mode. Since compatibility with the previous linker toolset is a high priority, on Itanium-based system the linker uses much of the old behavior in the new toolset. The Itanium-based system linker includes two options to allow you to instruct the linker to link in one of the following modes:

Compatibility mode, with the +compat option, to create a link and operation in PA-32 mode. Because of some object file format restrictions, the mode is not completely compatible with the style of the PA-32 linker.

Standard mode, with the +std option, set by default in the linker on Itanium-based system, to create a link and load operation in PA-64 mode. This mode uses the new behaviors and features of the PA-64 linker.

Using the Linker with +compat for Compatibility Mode

The +compat option instructs the linker to do a PA-32 link.

When you use the +compat option, the linker:

Uses PA-32 shared library internal name processing.

Lists all dependent shared libraries in a DT_HP_NEEDED entry the dynamic table using the PA-32 shared library naming conventions. These dependent libraries are recorded as

46 Determining How to Link Programs or Libraries (Linker Tasks)

Page 46
Image 46
HP UX Software Transition Kit (STK) manual Controlling Output from the Unwind Table with +strip unwind