HP C/aC++ for PA-RISC Software manual Symbol Binding Options, Bdefault, Bextern

Models: C/aC++ for PA-RISC Software

1 230
Download 230 pages 50.97 Kb
Page 89
Image 89

Passing Options to the Linker with -W

The following example links file.o and passes the option -a archive to the linker, indicating that the archive version of the math library (indicated by -lm) and all other driver-supplied libraries should be used rather than the default shared library:

aCC file.o -Wl,-a,archive -lm

Passing Multiple Options to the Linker with -W

The following example links file.o and passes the options -a , archive, -m, and -vto the linker:

aCC -Wl,-a,archive,-m,-v file.o -lm

This case is similar to the previous example, with additional options. -mindicates that a load map should be produced. The -voption requests verbose messages from the linker.

Symbol Binding Options

The following -Boptions are recognized by the compiler to specify whether references to global symbols may be resolved to symbols defined in the current load module, or whether they must be assumed to be potentially resolved to symbols defined in another load module.

A global symbol is one that is visible by name across translation unit boundaries. A static symbol is one that is visible by name only within a single translation unit but is not associated with a particular procedure activation. A locally defined symbol is a global or static symbol with a definition in the translation unit from which it is being referenced.

-Bdefault

-Bdefault

Global symbols are assigned the default export class. These symbols may be imported or exported outside of the current load module. The compiler will access tentative and undefined symbols through the linkage table. Any symbol that is not assigned to another export class through use of another -Boption will have the default export class. The -Bdefaultoption may also be used on a per symbol basis to specify exceptions to global -Bprotected, -Bhidden, and -Bexternoptions.

Usage:

-Bdefault=symbol[,symbol...]

The named symbols are assigned the default export class.

-Bdefault:filename

The file indicated by filename contains a list of symbols, separated by spaces or newlines. These symbols are assigned the default export class.

-Bextern

-Bextern

The specified symbols, or all undefined symbols if no list is provided, are assigned to default export class. Additionally, the compiler will inline the import stub for calls to these symbols. No compile time binding of these symbols will be done. All references to these symbols will be through the linkage table, so an unnecessary performance penalty will occur if -Bexternis applied to a listed symbol that is resolved in the same load module.

Usage:

-Bextern=symbol[,symbol...]

The named symbols, or all symbols if no list is provided, are assigned the default export class. Use of list form overrides the default binding of locally defined symbols.

Symbol Binding Options 89

Page 89
Image 89
HP C/aC++ for PA-RISC Software manual Symbol Binding Options, Bdefault, Bextern, Passing Options to the Linker with -W