Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shlib(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ld

profil

shlib

PURPOSE

     Creates a shared library.

SYNOPSIS
     shlib [ -kkey ] [ -ofile ]  [ -rrev ] infile [ -n | -v | -a ] outfile ...


DESCRIPTION

     The shlib command creates a  shared library from a set of
     unshared object and/or archive files.  The shared library
     it creates has two parts:

     o   A single shared library  text image that contains the
         code, and only the code, from all of the input files.
     o   Modified archive  or object  files that refer  to the
         text image, each  of which corresponds to  one of the
         shlib input files.

     By default, shlib  uses the name of the  first input file
     to  generate the  shared library  key.  It  does this  by
     removing any  directory path from  the file name  and, if
     the  file name  does  not contain  a  suffix, adding  the
     suffix .yyddd,  where yy  is the last  two digits  of the
     current year  and ddd  is the number  of the  day.  shlib
     puts this key  in each of the modified  output files.  By
     default, it also uses this key  as the name of the shared
     library text image, which contains the shared library key
     in a form that can be found by the what command.

     The shlib command transforms each input file specified on
     the  command  line  and  copies it  to  (or  verifies  it
     against)  an  output  file.  Each  output  object  module
     differs  from the  corresponding input  object module  in
     that the text  portion has been removed and  added to the
     end of the shared library text image.  shlib also appends
     the shared  library key to  each output module  and marks
     its a.out  header so the  ld command recognizes  that the
     file refers to a  shared library and relocates references
     appropriately.

     Once you create an archive  for a shared library, you can
     use the  ar command  to replace individual  object files.
     The  new  object  files  will not  refer  to  the  shared
     library, thus allowing you to patch shared libraries.

     The shlib  command can process  all cc and  f77 programs.
     Other programs must have  KCALL relocation entries as the
     only external references within the text portion (see the
     a.out file in AIX  Operating System Technical Reference).
     KCALL   relocation   entries   are  replaced   by   balax

     instructions  to location  0xC00,  which  contain a  code
     fragment to  continue calls  across segments.   That code
     requires that  register 0 point  to the constant  pool of
     the called routine, the first entry of which is the entry
     point of the invoked routine.

FLAGS

     -a  outfile         Adds new  object modules  in archives
                         to outfile.  This  lets you add func-
                         tions to a  shared library, replacing
                         the shared library text image without
                         relinking programs that  refer to it.
                         The entire shared  library image must
                         be rebuilt.
     -kkey               Uses  the shared  library key  in the
                         output object modules to refer to the
                         shared  library text  image.  If  key
                         does  not  contain  a .  (period),  a
                         suffix in the form .yyddd is added.
     -n  outfile         Makes  a  new  output file  for  each
                         input file.
     -ofile              Assigns the  name file to  the shared
                         library  text  image.   shlib  always
                         makes  a  new   shared  library  text
                         image, replacing the old one.
     -rstring            Adds string to the  end of the shared
                         library key in the what string.  This
                         only applies to the text image file.
     -v  outfile         Verifies  components   of  a  changed
                         shared  library,  thus ensuring  that
                         the  resulting object  files are  the
                         same as the  files previously created
                         by shlib.  Changes can  be made  to C
                         source code as  long as references to
                         external   names   are   not   added,
                         deleted,   or   rearranged   and   no
                         floating  point,  string,  or  static
                         initial values are modified.

EXAMPLES

     1.  To create a new shared text image:

           shlib -kclibs -r"C shared library text" \
              /lib/libc.a -n /lib/libcs.a /lib/librts.a -n /lib/librtss.a

         This   creates   shared   libraries   "libcs.a"   and
         "librtss.a"  and the  text  image file  "clibs.86133"
         ("86133" indicates that this  file was produced on 13
         May 1986).
     2.  To modify an existing shared text image:

           shlib -kclibs -r"C shared library text" \
              /lib/libc.a -a /lib/libcs.a  /lib/libm.a -n /lib/libms.a

         This  updates the  shared library  "libcs.a", creates
         the  shared library  "libms.a", and  updates the  the
         shared  text  image   "clibs.86133".   ("libc.a"  may

         contain  new members  that  are added  to the  shared
         library and the the text image.)
     3.  To create a  shared text image with  a different name
         than its key:

           shlib -kclibs -octext_image -r"C shared library text" \
              /lib/libc.a -n /lib/libcs.a  /lib/librts.a -n /lib/librtss.a

         This produces a text  image file named "ctext_image".
         Note that you  must use the -k flag  when you compile
         programs that use this text  image, since the key and
         the file name are not the same:

           cc  myproj.c -kclibs:ctext_image -lrtss -lcs

RELATED INFORMATION

     The following command:  "ld."

     The profil system call, monitor subroutine and a.out file
     in AIX Operating System Technical Reference.

     The  discussion  of  shared libraries  in  AIX  Operating
     System Programming Tools and Interfaces.

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