home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / bsd / 10191 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  5.1 KB

  1. Path: sparky!uunet!enterpoop.mit.edu!snorkelwacker.mit.edu!ai-lab!hal.gnu.ai.mit.edu!ericy
  2. From: ericy@hal.gnu.ai.mit.edu (Eric Youngdale)
  3. Newsgroups: comp.unix.bsd
  4. Subject: Re: Shared lib benchmarks, and experiences
  5. Date: 14 Dec 1992 17:02:37 GMT
  6. Organization: /etc/organization
  7. Lines: 80
  8. Distribution: usa
  9. Message-ID: <1giendINNgku@life.ai.mit.edu>
  10. References: <veit.724064215@du9ds3> <1gdnvrINNp80@life.ai.mit.edu> <1992Dec12.235116.7484@rwwa.COM>
  11. NNTP-Posting-Host: hal.gnu.ai.mit.edu
  12.  
  13. In article <1992Dec12.235116.7484@rwwa.COM> witr@rwwa.com writes:
  14. >In article <1gdnvrINNp80@life.ai.mit.edu>, 
  15. >ericy@hal.gnu.ai.mit.edu (Eric Youngdale) writes:
  16. >
  17. >| Perhaps you do not understand.  The way our linux libraries are made, you can
  18. >| just drop a new version into the /lib directory, and add a symlink, and you are
  19. >| ready to run the same binaries with the new sharable library. There is no need
  20. >| to relink[...]
  21. >
  22. >According to private correspondence, I'm told you can even do this without
  23. >the symlink by using environment variables.
  24. >
  25. >But, there are severe restrictions:
  26. >
  27. >  1) The two librarys must have identical ``assigned'' addresses, and
  28. >  2) The two librarys must be substantially identical.
  29.  
  30.     The first point is correct.  I should point out that there is no reason
  31. why we cannot have two different libraries assigned to the same address - you
  32. just will not be able to use both at the same time in the same process.  The
  33. way that it works is that there is something very analagous to a global
  34. constructor in C++, which looks for certain "special" variables.  These
  35. variables contain the name of the sharable library, the assigned address, and
  36. the version number.  When crt0 sees these variables, the requested libraries
  37. are mapped into the address space of the process.
  38.  
  39. The second one depends upon how you define "substantially".
  40.  
  41. >By #2 I mean that if the second library is, say, built from a completely
  42. >different set of object files, and a completely different set of ``internal''
  43. >routines, and is of a substantially different size, it won't work (even though
  44. >the ``interface'' is the same).  This is why I raised the example of 
  45. >Xaw3d -vs- Xaw.  On SVR4 each process can elect to use one or the other of 
  46. >these libraries with the same binarys (say xterm) at the same time.  I
  47. >still don't think this is the case with linux, but correct me if I am wrong.
  48.  
  49.     The example that you provide of Xaw/Xaw3d is not one that I am terribly
  50. familiar with.  As a rule of thumb, as long as you can provide identical
  51. assigned addresses, you can generate plug compatible libraries.  The
  52. limitations have less to do with the design of the library itself, but have
  53. more to do with the tools that we have available to ensure that the various
  54. addresses remain the same from one version to the next.
  55.  
  56.     The tricky bit in the past had been how you assign identical addresses
  57. to global data, and up until recently we had simply placed all global data in a
  58. separate file.  This worked fine for libc, but did not work for the X libraries
  59. (so I am told) because it would have meant modifying the X source code heavily.
  60. Thus the libraries had to be nearly identical so that individual data items did
  61. not get moved around in memory, and what you were told in private
  62. correspondence is essentially correct for things as they stand now with the
  63. publicly available libraries that we have.
  64.  
  65.     I recently came up with a way of "extracting" the global variable
  66. declarations from the main files and shunting them off to separate files, so we
  67. now have complete freedom to arrange the global data any way we wish (as long
  68. as two variables do not overlap).  All of this is handled at the assembly code
  69. level, so there are no source code modifications to the library required.  If
  70. we assume that Xaw and Xaw3d have a common interface for the Xaw part, then
  71. there is no reason in principle why one cannot have sharable libraries for the
  72. two cases that have an identical interface.
  73.  
  74.     I want to add in passing that there were a lot of people who wanted
  75. some kind of dynamic linking instead of what we ended up with.  Clearly there
  76. are pros and cons to either approach, and we had to balance these to come up
  77. with an answer.  As I recall the biggest drawbacks to the dynamic linking were
  78. the need for a new assembler and linker, the need for more extensive kernel
  79. mods, larger binaries and more overhead to load a program.  In its favor
  80. was the greater likelyhood that old binaries would still run with a new
  81. library, and no need for assigning addresses ahead of time.
  82.  
  83.     Finally some people are wondering why we are discussing the linux
  84. shared libraries on the comp.unix.bsd list.  The original question had to do
  85. with shared experiences, and some people naturally were wondering how we do
  86. this under linux.  This is somewhat of a moving target, although most of this
  87. is not visible to the regular user.  Since I have been close to some of the
  88. discussions relating to the development I wanted to give my perspective and let
  89. you know where we currently are.  You will ultimately decide one thing or
  90. another, and the only thing that I can guarantee is that some people will not
  91. be happy.  In our experience, the malcontents will eventually forget about it.
  92.  
  93.