MKSHLIB(8) BSD System Manager's Manual MKSHLIB(8)NAME
mkshlib - create static shared libraries
SYNOPSIS
mkshlib [-Lv] [-larchive] [-m shlib.map] ...
DESCRIPTION
The mkshlib utility builds or rebuilds the standard static shared li-
braries for the system, along with their corresponding stub libraries.
The following flags and arguments are recognized:
-L Instructs mkshlib that the input library archives and the
output shared libraries and stub libraries are local to
the current directory, with generic names (no version
numbers). This flag is useful in Makefiles.
-larchive Rebuilds based on the linker name of a library; for exam-
ple, -lc builds the shared C library /shlib/libc_s.4.0.0.
-m shlib.map Specify an alternate shlib.map file. If the shlib.map
argument does not contain a `/' character, mkshlib will
prepend the string `/etc/shlib.map.' to it. This option
overrides the SHLIB_MAP variable (see below).
-v Verify the shlib(8) commands that would be used to build
the libraries, but do not execute them. This flag is
useful for debugging shlib.map files.
If no archives are specified explicitly, mkshlib processes all the
archives in the shlib.map file. For each library that is to be built,
mkshlib prints the corresponding shlib(8) command before executing it.
Mkshlib reads a master list of shared library directives from the
shlib.map file. This file contains one entry for each standard shared
library, along with other material that is processed by the shell
(sh(1)). Entries are lists of arguments that start with a MAP command.
Each entry contains at least 5 whitespace-separated arguments following
the MAP command:
-larchive The linker flag for the given library archive.
text-address The address at which the shared library text is loaded,
given in hexadecimal with no 0x prefix.
data-address The address at which the shared library data is loaded,
given in hexadecimal with no 0x prefix.
source The pathname of the source archive library corresponding
to the linker flag.
image The pathname of the shared library image corresponding to
the linker flag and the source archive.
Any additional fields are passed as arguments to shlib(8). These fields
are typically used to pass the linker flag names for shared images that
are prerequisites for the given shared image. For example, the shared
compat library -lcompat needs to be linked against the shared C library
-lc. Following shell syntax, lines that end in a backslash are joined
with the following line and the backslash is removed.
Entries in shlib.map should be ordered according to their prerequisites;
for example, the entry for -lcompat should follow the entry for -lc.
Lines other than library entries are passed directly to the shell. The
usual shell expansions are performed on entries, so you can set a shell
variable and use it in a subsequent library entry.
Stub archive libraries are created in the directory of the source archive
library, using the name of the shared library image suffixed with `.a'.
For example, the -lcompat library might have a source archive of
/usr/lib/libcompat.a and a shared image named /shlib/libcompat_s.4.0.0;
the stub library would thus be /usr/lib/libcompat_s.4.0.0.a.
Mkshlib looks for library-specific loader files in the directory where
the archive library is located, under the name loader.library.c. If it
finds no appropriate library-specific loader, the generic loader
/usr/lib/loader.c is used.
EXAMPLES
Here is an excerpt from a sample shlib.map file:
VER=4.0.0
UL=/usr/lib
# -lX text data source archive shared image
MAP -lstdc++ a0410000 a0448000 $UL/libstdc++.a $UL/libstdc++_s.$VER \
-X stdfiles.o -E -lgcc -lm -lc
FILES
/etc/shlib.map default table of shared library information
/usr/sbin/shlib utility to build individual shared libraries
ENVIRONMENT
SHLIB_MAP if set, gives an alternate shlib.map file
SEE ALSOshlib(8), shlicc(1)BUGS
To create dynamic shared libraries, use ld(1).
In the event that you need to build a new shared library from scratch
without reference to a previous version, you must change the name of the
current shared library image in shlib.map before running mkshlib. This
new image name will be compiled into future binaries, which will not ref-
erence the same image file as older binaries. Normally, a complete set
of compatible libraries is built together by changing a single version
number variable in the shlib.map file.
BSD/OS October 31, 1997 2