converting dynamically linked executables to static

dan at bbn.com dan at bbn.com
Fri Oct 13 05:31:28 AEST 1989


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



More information about the Comp.sys.sun mailing list