-qmkshrobj

Category

Output control

@PROCESS

None.

Purpose

Creates a shared object from generated object files.

Use this option, together with the related options described later in this topic, instead of calling the linker directly to create a shared object. The advantage of using this option is that it is compatible with -qipa link-time optimizations (such as those performed at -O5).

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -q--mkshrobj-----------------------------------------------><

Defaults

By default, the output object is linked with the runtime libraries and startup routines to create an executable file.

Usage

When the -qmkshrobj option is specified, the driver program starts the CreateExportList utility to create an export list from the input list of object files.

The compiler automatically exports all global symbols from the shared object unless you specify which symbols to export by using -bE:, -bexport:, or -bnoexpall. You can also prevent weak symbols from being exported by using the -qnoweakexp option. IBM extensionSymbols that have the hidden or internal visibility attribute are not exported.IBM extension

Specifying -qmkshrobj implies -qpic.

You can also use the following related options with -qmkshrobj:

-o shared_file
The name of the file that holds the shared file information. The default is shr.o.
-qexpfile=filename
Saves all exported symbols in filename
-e name
Sets the entry name for the shared executable to name.
-q[no]weakexp
Specifies whether symbols marked as weak are to be included in the export list. If you do not explicitly set this option, the default is -qweakexp (global weak symbols are exported).

For detailed information about using -qmkshrobj to create shared libraries, see Compiling and linking a library.

Examples

To construct the shared library big_lib.so from three smaller object files, enter the following command:
xlf -qmkshrobj -o big_lib.so lib_a.o lib_b.o lib_c.o

Related information