LORDER(1,C) AIX Commands Reference LORDER(1,C)
-------------------------------------------------------------------------------
lorder
PURPOSE
Finds the best order for files in an object library.
SYNTAX
lorder -- file --|
^ |
+------+
DESCRIPTION
The lorder command reads one or more object or library archive files, looking
for external references and writing a list of paired file names to standard
output. The first file in each pair contains references to identifiers that
are defined in the second file. You can send this list to the tsort command to
find an ordering of a library member file suitable for one-pass access by the
ld command.
The lorder command accepts any object or archive file regardless of its suffix
as long as multiple input files are specified. A single file must have a .o
suffix.
EXAMPLE
To create a subroutine library:
lorder charin.o scanfld.o scan.o scanln.o | tsort | xargs ar qv libsubs.a
This command creates a subroutine library named "libsubs.a" that contains the
files "charin.o", "scanfld.o", "scan.o", and "scanln.o".
The ordering of the object modules in the library is important. The ld command
requires that each module precede all the other modules that it calls or
references. The lorder and tsort commands together add the subroutines to the
library in the proper order.
Suppose that the file "scan.o" calls the files "scanfld.o" and "scanln.o". The
file "scanfld.o" also calls the file "charin.o". First, the lorder command
creates a list of pairs that shows these dependencies:
Processed November 8, 1990 LORDER(1,C) 1
LORDER(1,C) AIX Commands Reference LORDER(1,C)
charin.o charin.o
scanfld.o scanfld.o
scan.o scan.o
scanln.o scanln.o
scanfld.o charin.o
scan.o scanfld.o
scan.o scanln.o
Next, the | (vertical bar) sends this list to the tsort command, which converts
it into the ordering we need:
scan.o
scanfld.o
scanln.o
charin.o
Each module precedes the module it calls. The file "charin.o", which does not
call another module, is last.
The second | (vertical bar) then sends this list to the xargs, command which
constructs and runs the following ar command:
ar qv libsubs.a scan.o scanfld.o scanln.o charin.o
This ar command creates the properly ordered library.
FILES
/tmp/sym* Temporary files.
RELATED INFORMATION
See the following commands: "ar," "ld," "nm" "tsort," and "xargs."
See the ar file in AIX Operating System Technical Reference.
Processed November 8, 1990 LORDER(1,C) 2