home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / aix / 12895 < prev    next >
Encoding:
Text File  |  1992-12-29  |  4.1 KB  |  94 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!courant.SLAC.Stanford.EDU!alhy
  3. From: alhy@courant.SLAC.Stanford.EDU (J. Scott Berg)
  4. Subject: Shared libraries: the -bM: option to ld
  5. Message-ID: <C00Bnq.29q@unixhub.SLAC.Stanford.EDU>
  6. Sender: news@unixhub.SLAC.Stanford.EDU
  7. Reply-To: ALHY@slac.stanford.edu
  8. Organization: Stanford University, dept of Physics / SLAC
  9. Date: Tue, 29 Dec 1992 06:07:01 GMT
  10. Lines: 82
  11.  
  12. Can somebody give a detailed explanation of the -bM: option to ld?  I
  13. wanted to have a shared object that had a static (file-scope) variable
  14. such that
  15.  
  16. main() calls shrf(5) and objf(3);
  17. objf(x) calls shrf(x)
  18.  
  19. shrf() is in the shared object, as is the variable x.  shrf() sets the
  20. variable x to the argument.  The desired effect is that objf() and
  21. shrf() are setting different memory locations.  If I link both objf
  22. and shrf as -bM:S1L, what I find is that in fact both are referencing
  23. the same variable.
  24.  
  25. Now, I tried a two-step integration on objf:  The first step loaded
  26. shrf and objf, didn't load the c libraries, and had the options 
  27.  
  28. -berok -bnso -bM:1L
  29.  
  30. Now, if I do this, the behavior is completely determined (as far as I
  31. can tell) by what my -bM: option is on the second step of the link
  32. (where I link in the c libraries):  If it's shared (1L or RE), the
  33. desired behavior occurs.  If it's not shared (again, either 1L or RE),
  34. the desired behavior doesn't occur (both calls reference the same
  35. memory location).  This seems to be independent of the -bM: option
  36. that I compile with!!!
  37.  
  38. So, can anybody explain to me what's going on?  Enclosed is the
  39. tarred/compressed/uuencoded set of files that I ran the test with.
  40. Thanks
  41.  
  42.                 -Scott Berg
  43.  
  44. begin 444 test.tar.Z
  45. M'YV03<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2`.-
  77. `
  78. end
  79.  
  80.  
  81.  
  82. -- 
  83. -------------------------------------------------------------------------------
  84. The opinions expressed here are, of course, my own and nobody else's.
  85. -------------------------------------------------------------------------------
  86. J. Scott Berg
  87. email: ALHY@slac.stanford.edu
  88. real mail: Varian Physics
  89.            Stanford  CA  94305-4060
  90. phone:    (415) 926-4732 (w)
  91.      (415) 326-2631 (h)
  92. -------------------------------------------------------------------------------
  93.  
  94.