[net.unix-wizards] Need help with symbol table and relocation info in .o files

weil@dataioDataio.UUCP (Steve Weil) (04/29/86)

This is a sticky one.  I am working on a large program with several
sections supported by different people.  It is too large to debug using
DBX or CDB when the whole program is compiled with the -g option.  I am
trying to write a utility which will take a partial link (a .o file
which is the result of ld -r) and will strip off the symbols which are
there solely for the debugger, but which will leave the symbols needed
for the final link.  (This is to avoid recompiling everything without
the -g flag.)

I have written a program which will do this successfully for a plain .o
file (from cc -c), but it does not work on partial links.  When I load
I get errors like "local symbol botch", or just core dumps.

Apparently, there is some relocation information associated with some
of the symbols I am removing.  The manual pages and include files do
not give me enough detail to understand what I need to do.  Can anyone
tell me a basic algorithm for keeping the relocation data consistent as
I remove symbols?  Specifically, does the r_address field in the
relocation data correspond to the n_value field in the nlist
structure?

Any help of any sort would be greatly appreciated.

Steve Weil
entropy!dataio!weil