Kenwood HP 9000 Personal Computer User Manual


 
120 Chapter 4
Linker Tools
Finding Object Library Ordering Relationships with lorder(1)
Finding Object Library Ordering
Relationships with lorder(1)
The lorder command finds the ordering relation for an object library. You
can specify one or more object or archive library files (see ar(1)) on the
command line or read those files from standard input. The standard
output is a list of pairs of object file names, meaning that the first file of
the pair refers to external identifiers defined in the second.
You can process the output with tsort to find an ordering of a library
suitable for one-pass access by ld (see tsort(1) and ld(1)). The linker ld is
capable of multiple passes over an archive in the archive format and does
not require that you use lorder when building an archive. Using the
lorder command may, however, allow for a slightly more efficient access
of the archive during the link-edit process.
The symbol table maintained by ar allows ld to randomly access
symbols and files in the archive, making the use of lorder unnecessary
when building archive libraries (see ar(1)).
lorder overlooks object files whose names do not end with .o, even
when contained in library archives, and attributes their global symbols
and references to some other file.
Examples
Build a new library from existing .o files:
$ar cr library ‘lorder *.o | tsort‘
When creating libraries with so many objects that the shell cannot
properly handle the *.o expansion, the following technique may
prove useful:
$ls |grep ’.o$’|lorder|tsort|xargs ar cq library