Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lorder(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar

ld

nm

tsort

xargs

ar

lorder

PURPOSE

     Finds  the  best order  for  member  files in  an  object
     library.

SYNOPSIS
     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 of  each paired  files 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
     ld.

     If object files do not end with .o, lorder overlooks them
     and  attributes their  global symbols  and references  to
     some other file.

EXAMPLE

     To create a subroutine library:

       lorder charin.o scanfld.o scan.o scanln.o | tsort | xargs ar qv libsubs.a

     This creates a subroutine  library named "libsubs.a" that
     contains    "charin.o",   "scanfld.o",    "scan.o",   and
     "scanln.o".  The  ordering of  the object modules  in the
     library  is  important.   The ld  command  requires  each
     module to 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  "scan.o" calls "scanfld.o"  and "scanln.o".
     "scanfld.o"  also calls  "charin.o".   First, the  lorder
     command creates a list of  pairs that shows these depend-
     encies:

       charin.o charin.o
       scanfld.o scanfld.o
       scan.o scan.o
       scanln.o scanln.o
       scanfld.o charin.o
       scanln.o charin.o
       scan.o scanfld.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

     Note  that  each module  precedes  the  module it  calls.
     "charin.o", which does not call another module, is last.

     The second  | then sends  this list to xargs,  which con-
     structs 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

     The following commands:  "ar,"   "ld," "nm" "tsort," and
     "xargs."

     The ar file in AIX Operating System Technical Reference.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026