home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / aix / 9563 < prev    next >
Encoding:
Internet Message Format  |  1992-09-10  |  2.3 KB

  1. Path: sparky!uunet!cs.utexas.edu!convex!linac!unixhub!unixhub.slac.stanford.edu!alhy
  2. From: alhy@unixhub.slac.stanford.edu (J. Scott Berg)
  3. Newsgroups: comp.unix.aix
  4. Subject: stripped shared objects
  5. Message-ID: <5454@unixhub.SLAC.Stanford.EDU>
  6. Date: 10 Sep 92 23:15:01 GMT
  7. Sender: news@unixhub.SLAC.Stanford.EDU
  8. Reply-To: alhy@unixhub.slac.stanford.edu
  9. Organization: Stanford University, dept of Physics / SLAC
  10. Lines: 47
  11. Nntp-Posting-Host: courant.slac.stanford.edu
  12.  
  13. Consider two ways of using shared objects:
  14.  
  15. 1) Create a shared object, and link it directly with your main program
  16.  
  17.     ld sub.o -o subshr.o -s -bE:sub.exp -bM:SRE -T512 -H512 -bh:4
  18.     xlc main.c subshr.o -o main -s
  19.  
  20. This works great, even though the shared object is stripped.  It
  21. apparently looks in the loader section to get the exported symbols and
  22. finds them just fine.
  23.  
  24. 2) Create a shared object, put it in a library, and use the -l flag to 
  25.    include the library
  26.  
  27.     ld sub.o -o shrsub.o -s -bE:sub.exp -bM:SRE -T512 -H512 -bh:4
  28.     ar cr libsub.a subshr.o
  29.     xlc main.c -L. -lsub -o main -s
  30.  
  31. This bombs.  The last compilation says that subshr.o in libsub.a has
  32. been stripped (which it has).  What I would like to have happen
  33. (ideally) is that just as case 1) uses the loader section to find the
  34. exported symbols, so should case 2).  Is there a way I can do this?
  35.  
  36. The reason that I want to do this is that I came up with this clever
  37. idea when compiling a library that consisted of a LARGE number of
  38. shared objects, and when I stripped them all before putting them in
  39. the library, the library was about HALF its size!  It's a big library,
  40. so this made me very happy, until I actually tried to use the library
  41. and it bombed.  By default, I use -x instead of -s (to only keep
  42. external symbols), but that doesn't seem to help as much.
  43.  
  44. Any help is greatly appreciated.  Thanks and God bless
  45.  
  46.                 -Scott Berg
  47.  
  48. -- 
  49. -------------------------------------------------------------------------------
  50. The opinions expressed here are, of course, my own and nobody else's.
  51. -------------------------------------------------------------------------------
  52. J. Scott Berg
  53. email: alhy@unixhub.slac.stanford.edu
  54. real mail: Varian Physics
  55.            Stanford  CA  94305-4060
  56. phone:    (415) 926-4732 (w)
  57.      (415) 326-2631 (h)
  58. -------------------------------------------------------------------------------
  59.  
  60.