home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8040 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  2.0 KB

  1. Path: sparky!uunet!ogicse!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!<UNAUTHENTICATED>+
  2. From: Barry_Wolman@transarc.com
  3. Newsgroups: comp.unix.aix
  4. Subject: Changing LIBPATH in an Executable
  5. Message-ID: <QeP7NVr0Bwxa8l5shq@transarc.com>
  6. Date: 21 Jul 92 12:41:05 GMT
  7. Article-I.D.: transarc.QeP7NVr0Bwxa8l5shq
  8. Organization: Carnegie Mellon, Pittsburgh, PA
  9. Lines: 44
  10.  
  11. I'd like to be able to change the LIBPATH stored in an executable.  I
  12. realize I can use
  13.     setenv LIBPATH ...
  14. to specify a LIBPATH that overrides the LIBPATH stored in an
  15. executable.  Doing this presents a problem if one is dealing with
  16. multiple executables having different LIBPATH requirements.
  17.  
  18. I tried writing a simple utility that did the following (I've glossed
  19. over some details):
  20.  
  21. 1. Find the loader section header
  22.  
  23. 2. Read and parse the import triples (path, base, and archive)
  24. specified by the loader section header
  25.  
  26. 3. Replace the path component (LIBPATH) of the first import triple
  27. with the string specifying the new LIBPATH
  28.  
  29. 4. Write the new import table at the end of the executable
  30.  
  31. 5. Update the loader section header to reference the new import table
  32. (updated values for l_islen and l_impoff)
  33.  
  34. 6. Rewrite the updated loader section header
  35.  
  36. This partially works.  When I used "dump -H" to display the import
  37. list for the modified file, it shows the new LIBPATH and the other
  38. information is unchanged.  But, when I try to execute the resulting
  39. object module, I get
  40.  
  41. perf[barry] hello
  42. Could not load program hello
  43. hello is not executable or not in correct XCOFF format
  44. Error was: Exec format error
  45.  
  46. So, it appears that AIX may be making assumptions about the structure
  47. of the object module not reflected in the documentation.  Does anyone
  48. know what else I need to change to get this utility to work?  Even
  49. better,  if such a utility already exists, where can I find it?
  50. I'll be glad to donate mine if I can finish it, but I'd rather just
  51. use an existing program.
  52.  
  53. Thanks,
  54. Barry Wolman
  55.