home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!mel.dit.csiro.au!yarra!yarrina.connect.com.au!codex!bpja
- From: bpja@codex.oz.au (Brett Adam)
- Newsgroups: comp.unix.aix
- Subject: HARD problem with shared libraries (long)
- Message-ID: <1992Sep14.115643.837@codex.oz.au>
- Date: 14 Sep 92 11:56:43 GMT
- Sender: bpja@codex.oz.au
- Reply-To: bpja@codex.oz.au
- Organization: Codex Software Development Pty Ltd
- Lines: 72
-
- To any AIX shared library 'gurus' out there ....
-
-
- Part of a product I'm porting at the moment requires that a number of routines
- in the standard shared library, libc.a, be 'enhanced'. The idea is that this be
- done is such a way that existing (compiled) software automatically gain access
- to the new enhanced functionality.
-
- In particular, the functions 'getpwent', 'gethostbyname' and others need to be
- extended with a 'pre-patch' to consult an alternative database BEFORE falling
- back to their previous behaviour. (Which means the replacement routine must
- call the original routine)
-
-
- Our strategy on the Sun was simple:
-
- Unarchive libc.a
-
- Take the existing routines, and rename them in the library. Thus, getpwent()
- becomes tnewpteg() or similar.
-
- Write new getpwent() that does extra work, then calls tnewpteg() if required,
- to get the old behaviour.
-
- Wrap our new object files and the original objects with renamed routines back
- up into a shared libc.a.
-
- This works admirably - on the Sun.
-
-
- Under AIX 3.2, we hit a stumbling block. Whilst the bind tool is _very_
- powerful, and can do all the renaming for us easily, we cannot package the
- shared library back up once again.
-
- In particular, a load line such as the following produces an output file that
- grows without bounds - until it fills the entire disk!!
-
-
- ld -r -brename:.getpwent,.tnewpteg shr.o -o shr.o.new -bM:SRE
-
- (The libc.a member shr.o seems to contain the routines that need enhancing)
-
- I've spent a _lot_ of time experimenting with using the bind tool interactively
- to try and find a way to achieve what we want. No luck.
-
- We've even written an xcoffpatch tool that makes the substitutions directly in
- the XCOFF shr.o file. Works fine, but we cannot wrap up our new objects with
- the shr.o object without hitting the infite file problem.
-
- I've tried all manner of import/export scenarios to no avail.
-
- Indeed, when I _think_ that I have a new libc.a constructed, upon installation,
- all existing tools simply output "Killed" when executed. (Pretty clear
- indication that the new libc.a is bogus).
-
-
- The point:
-
- Does ANYONE out there have any experience with this sort of approach?
- Does anyone have any better ideas about how to achieve the desired result?
- (short of obtaining the entire source to libc.a and re-building it ourselves!)
- (of course, if that option is available.... :-) )
-
-
- Thanks in hopeful anticipation,
-
-
- --
- ---------------------------------------------------------------
- Brett Adam Xedoc Software Development Pty. Ltd.
- NeXTMail: bpja@codex.oz.au AppleLink: AUST0335
- (Preferred.) (Only if you must)
-