home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / programm / 6030 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  1.4 KB

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!not-for-mail
  2. From: freeman-eric@cs.yale.edu (Eric Freeman)
  3. Newsgroups: comp.unix.programmer
  4. Subject: loading executables into the data segment (poor man's exec)
  5. Date: 22 Jan 1993 20:39:23 -0500
  6. Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158
  7. Lines: 21
  8. Distribution: world
  9. Message-ID: <1jq7kbINN4bp@DALTON.SYSTEMSY.CS.YALE.EDU>
  10. NNTP-Posting-Host: dalton.systemsy.cs.yale.edu
  11.  
  12. I'm currently trying to write a hacked version of exec on a SPARC station.
  13. This will eventually be ported to a special purpose machine with a 
  14. SPARC chip running a subset of UNIX that does not support exec.
  15.  
  16. My version of exec allocates enough memory using valloc for the text/data/bss 
  17. sections of the a.out file, loads the text and data sections at the 
  18. appropriate  locations in the allocated memory and then jumps to the address
  19. of a certain function.  I'm using the -T option of the linker to force the
  20. text segment to begin at the same location as the allocated memory.  I've
  21. also specified the -Bstatic flag.
  22.  
  23. While I can get simple functions to work (simple arth, simple printfs with 
  24. only text), anything complex bombs.  If anyone has written a similar program 
  25. and can offer some suggestions I'd really appreciate it.  From what I can
  26. tell with dbx everything is being loaded at the correct address.
  27.  
  28. Thanks,
  29.  
  30. Eric
  31.  
  32. freeman-eric@cs.yale.edu
  33.