rebuilding the shared libc

Marc Auslander marc at watson.ibm.com
Fri Jun 7 23:19:46 AEST 1991


You need a file called libc.exp.  But its not shipped!  So you have to
hack one.  

Extract the old shr.o from libc.a.  Then dump -n shr.o.  The output is
a list of all the imported and/or exported symbols for the object.
In general, you need to reduce this to a list of exported symbols.
The IMEX field is supposed to tell you this, but its coding is
apparently funny.  It should correspond to the l_smtype field in
/usr/include/loader.h, but the bits appear scrambled.  BUT, for
libc.a[shr.o] all the symbols are in fact exported, so just take them
all.  Then, to replace a program, for example malloc.o, do:

ld malloc.o shr.o -o newshr.o -bE:libc.exp -bI:/lib/syscalls.exp

and put the new shr.o (named shr.o) into libc.a.

You can test the new libc.a first by setting
LIBPATH=mydir:/lib:/usr/lib where mydir contains the new libc.a and
running stuff.  If that looks good, you can (as root) mount
mydir/libc.a /lib/libc.a 
which will override all subsequent uses in the system until you reboot or unmount.

To replace libc.a, you should, as root:

cp mydir/libc.a /lib/newlibc.a
cp -p /lib/libc.a /lib/libc.a.orig  (only do this once)
mv /lib/newlibc.a /lib/libc.a

mv is atomic, so you don't risk winding up with no libc.a at all.  

If the new libc.a breaks the system, you will have to boot from
diskette to fix it!
--


Marc Auslander       (IBM)<marc at marc.watson.ibm.com>  (Internet)<marc at watson.ibm.com>



More information about the Comp.unix.aix mailing list