a dissassembler for the unix-pc
Alex S. Crain
alex at umbc3.UMD.EDU
Thu Oct 6 04:50:27 AEST 1988
I took the COFF version of the unc program that lenny posted last
week and taught it about SGS (specifically 3b1) syntax, and a few other
things. It now does the following things:
1) Generates valid SGS assembly code, with all available symbols.
2) Copes with the shared library. code compile with the shared
library will have the shared library symbols appear in the output,
addresses > 0x300000 are considered constants.
3) Replace valid pc reletive addresses with labels, so that
jsr 66(%pc)
...
link %fp,&4
becomes
jsr TL133
...
TL133:
link %fp,&4
4) Decode Switch statements. the unixpc assembler requires an illegal
instruction to preceed jump tables, which would decode to tas &<xxx>,
where xxx is the size of the table offset. the dissassembler uses this
to realize that a jump table is happening and insert labels at all the
appropriate places.
The dissassembler surely still has one or two bugs, but I don't have
anymore time right now, so out it goes. I was able to do
% unstrip ln
% dis a.out > ln.s
% vi ln.s # have to insert a global _start symbol
# at the start of the file.
% as ln.s
% ld /lib/shlib.ifile ln.o -o ln
the resulting file worked fine. I didn't pursue the concept of rebuilding
the world with this thing any furthur :-). I will gladly accept bug reports
and will post patches as I create them.
The dissassembler should work fine for any SGS/COFF file, although
the shlib and swbeg stuff is unix-pc specific. Should be ok for the small
hp-9k machines (no 680[23]0 support).
I have posted the files to unix-pc.sources. I wonder about the
distribution of that group, and I really don't want to distribute this
thing by mail, so if I get a bunch of requests from people for the source,
I will send it off the comp.sources.misc.
--
:alex.
Systems Programmer
nerwin!alex at umbc3.umd.edu UMBC
alex at umbc3.umd.edu
More information about the Unix-pc.general
mailing list