home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / hp / 12728 < prev    next >
Encoding:
Internet Message Format  |  1992-11-09  |  2.6 KB

  1. From: curtw@hpcuhe.cup.hp.com (Curt Wohlgemuth)
  2. Date: Tue, 10 Nov 1992 01:36:32 GMT
  3. Subject: Re: Changing a shared library into a non-shared library
  4. Message-ID: <31480278@hpcuhe.cup.hp.com>
  5. Organization: Hewlett Packard, Cupertino
  6. 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
  7. Newsgroups: comp.sys.hp
  8. References: <1992Nov9.041051.3266@codex.oz.au>
  9. Lines: 54
  10.  
  11. bpja@codex.com.au (Brett Adam) writes:
  12.  
  13. > Under HP/UX 8.x on a 700 series machine, is it possible to modify/change a  
  14. > shared library into a non-shared relocatable object file for input to the  
  15. > linker?
  16.  
  17. No.
  18.  
  19. > The real question:
  20. > I have a shared library which I want to add new objects to. I don't have the  
  21. > source to the shared lib. Hence, I need to find a way to feed an existing  
  22. > shared library through the linker. (I think).
  23.  
  24. There is no provision to do this; basically, you want "ar"-like
  25. functionality to update, add, or delete object modules from a shared
  26. library.  The linker needs the original object files in order to rebuild
  27. the shared library from scratch.
  28.  
  29. > Having examined the header structures, etc. I can't see much difference between
  30. > a shared library and a relocatable executable at the structural level. Sure a
  31. > shlib has additional dynamic loader entries in the code section, etc. but the 
  32. > bulk of the content is still structurally the same.
  33. > I've tried changing the filetype from 0x10e to 0x106, but without knowing the
  34. > checksum algorithm used for the fileheader, the linker rejects my file as being
  35. > corrupt.
  36.  
  37. I assume by "relocatable executable" you mean "relocatable object file";
  38. that's what a magic number of 0x106 means.
  39.  
  40. There is a __world__ of difference between a relocatable object file
  41. (.o) and a shared library; actually, a shared library is much closer to
  42. an executable file (a.out) than an object file.
  43.  
  44. Basically, a shared library has its symbolic relocations resolved, and
  45. there's no way to retrieve them.  For example, a module in a shared lib
  46. references data symbolically by name; by the time the linker is done,
  47. the name is essentially gone, and the reference to data is simply via a
  48. slot in the linkage table.
  49.  
  50. If you want to modify a shared library, the linker must rebuild the
  51. linkage table as well as the other tables in the shared lib to reflect
  52. the contents; this must be done using relocation information in object
  53. files, which are absent in a shared library or executable file (see
  54. /usr/include/reloc.h).
  55.  
  56. Hope this helps,
  57.  
  58. Curt Wohlgemuth
  59. California Language Lab
  60. curtw@cup.hp.com
  61.  
  62. p.s.: the usual disclaimers apply to the above information.
  63.