lorder
— list
dependencies for object files
The lorder
utility uses
nm(1) to
determine interdependencies between object files and library archives listed
on its command line. It then outputs a list of pairs of file names such that
the first file in each pair references at least one symbol defined by the
second.
The output is normally used with
tsort(1)
when a library is created to determine the optimum ordering of the object
modules so that all references may be resolved in a single pass of the
loader.
Similarly, when linking static binaries,
lorder
and
tsort(1)
can be used to sort libraries in order of dependency.
While contemporary linkers no longer require the use of
lorder
, it is provided for the benefit of legacy
code bases and build systems which still insist on it.
ar cr library.a `lorder ${OBJS} | tsort`
cc -o foo ${OBJS} `lorder ${STATIC_LIBS} | tsort`
A lorder
utility appeared in
Version 7 AT&T UNIX.
The lorder
utility will not work properly
if given file names with spaces or newlines in them.