Kenwood HP 9000 Personal Computer User Manual


 
Chapter 3 81
Linker Tasks
Using Linker commands
Exporting Symbols with +ee
Like the +e option, the +ee option allows you to export symbols. Unlike
the +e option, the option does not alter the visibility of any other symbols
in the file. It exports the specified symbol, and does not hide any of the
symbols exported by default.
Exporting Symbols from main with -E
By default, the linker exports from a program only those symbols that
were imported by a shared library. For example, if a shared executable's
libraries do not reference the program's main routine, the linker does not
include the main symbol in the a.out file's export list. Normally, this is
a problem only when a program calls shared library management
routines (described inChapter 6, “Shared Library Management
Routines,” on page 195). To make the linker export all symbols from a
program, invoke ld with the -E option.
The +e option allows you to be more selective about which symbols are
exported, resulting in better performance. For details on +e, see
“Exporting Symbols with +e”.
Hiding Symbols with -h
The -h option allows you to hide symbols. Hiding a symbol makes the
symbol a local definition, accessible only from the object module or
library in which it is defined. Use -h if you simply want to hide a few
symbols.
You can use -h option when building a shared library (with -b) and
when linking to create an a.out file. When combining .o files with -r,
you can use the -h option.
The syntax of the -h option is:
-h symbol
The -h option hides symbol. Any other global symbols remain exported
unless hidden with -h.
Example Using -h
Suppose you want to build a shared library from an object file that
contains the following symbol definitions as displayed by the nm
command: