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