Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rice!sun-spots-request From: dan@bbn.com Newsgroups: comp.sys.sun Subject: Re: converting dynamically linked executables to static Keywords: Miscellaneous Message-ID: <2097@brazos.Rice.edu> Date: 12 Oct 89 19:31:28 GMT Sender: news@rice.edu Organization: Sun-Spots Lines: 22 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 159, message 4 of 16 I gather that you want to capture the libraries it was built with so you can take it to another machine? If you core-dump and undump, be careful. That doesn't restore the values of data associated with the shared library. So if shared-library data changed as the command ran before the dump was created, you can get inconsistent results. For example, when sbrk() is called to expand the address space, its internal pointer to the current end of memory gets updated. A core dump won't have this changed value, and undump won't put it in the new executable, but the address space *will* be larger; sbrk calls in the new executable produced by undump will return pointers into already-used address space. Malloc has similar problems. So if you go that route, you'll have to find some way to get the core dump from the executable before it's done *anything*. Probably adb could be used to set a breakpoint just after main() is entered. Our application uses undump to capture its context; after a lot of trying, we finally just loaded it statically initially in order for undump to work. Dan Franklin