home *** CD-ROM | disk | FTP | other *** search
- From: curtw@hpcuhe.cup.hp.com (Curt Wohlgemuth)
- Date: Tue, 10 Nov 1992 01:36:32 GMT
- Subject: Re: Changing a shared library into a non-shared library
- Message-ID: <31480278@hpcuhe.cup.hp.com>
- Organization: Hewlett Packard, Cupertino
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!scd.hp.com!hpscdm!cupnews0.cup.hp.com!hppad.waterloo.hp.com!hppad!hpfcso!hpcss01!hpcuhe!curtw
- Newsgroups: comp.sys.hp
- References: <1992Nov9.041051.3266@codex.oz.au>
- Lines: 54
-
- bpja@codex.com.au (Brett Adam) writes:
-
- > Under HP/UX 8.x on a 700 series machine, is it possible to modify/change a
- > shared library into a non-shared relocatable object file for input to the
- > linker?
-
- No.
-
- > The real question:
- >
- > I have a shared library which I want to add new objects to. I don't have the
- > source to the shared lib. Hence, I need to find a way to feed an existing
- > shared library through the linker. (I think).
-
- There is no provision to do this; basically, you want "ar"-like
- functionality to update, add, or delete object modules from a shared
- library. The linker needs the original object files in order to rebuild
- the shared library from scratch.
-
- > Having examined the header structures, etc. I can't see much difference between
- > a shared library and a relocatable executable at the structural level. Sure a
- > shlib has additional dynamic loader entries in the code section, etc. but the
- > bulk of the content is still structurally the same.
- >
- > I've tried changing the filetype from 0x10e to 0x106, but without knowing the
- > checksum algorithm used for the fileheader, the linker rejects my file as being
- > corrupt.
-
- I assume by "relocatable executable" you mean "relocatable object file";
- that's what a magic number of 0x106 means.
-
- There is a __world__ of difference between a relocatable object file
- (.o) and a shared library; actually, a shared library is much closer to
- an executable file (a.out) than an object file.
-
- Basically, a shared library has its symbolic relocations resolved, and
- there's no way to retrieve them. For example, a module in a shared lib
- references data symbolically by name; by the time the linker is done,
- the name is essentially gone, and the reference to data is simply via a
- slot in the linkage table.
-
- If you want to modify a shared library, the linker must rebuild the
- linkage table as well as the other tables in the shared lib to reflect
- the contents; this must be done using relocation information in object
- files, which are absent in a shared library or executable file (see
- /usr/include/reloc.h).
-
- Hope this helps,
-
- Curt Wohlgemuth
- California Language Lab
- curtw@cup.hp.com
-
- p.s.: the usual disclaimers apply to the above information.
-