objdump: i386 nasm-like output

Matthias Kramm matthias.kramm@stud.tu-muenchen.de
Fri Jul 27 03:47:00 GMT 2001


Hi all.

I poked around a little bit in objdump in order to achieve a disassembly output
which is similar to the netwide assembler (nasm) format.
I.e.. I did want to have

			mov ax,0x10
			mov [ds:bx+di],al
			add bx,0x1

instead of objdump's standard

			mov $0x10,%ax
			mov %al,%ds:(%bx,%di)
			add $0x1,%bx

as diassembly output.

I discovered -m i386:intel does a subset of what I wanted, at least it
swaps the registers ($0x10,%ax -> %ax,$0x10).

Also, I wrote a patch to get rid of the '%'s, '$'s and change 
[bx,di] to [bx+di], which is actually sufficient to achieve
an output in the format described above.
Are my changes to objdump (actually, libopcodes) interesting 
for a broader audience? Programmers coming from dos or windows 
systems are mostly used to nasm-like assemblers, like tasm or masm 
which use exactly the format above.

The patch in question is applied. I was wondering whether 
the decision how to disassemble should be implemented in 
a different way. At the moment, the patch simply overloads
the i386:intel machine format. 
Should one...
(a) introduce a new machine format (objdump -m)?
(b) use an disassembly option, which selects, for intel-architectures,
    which format to use? (objdump -M)
(c) Leave libopcodes alone, and only change objdump.c (I.e. filter the
    output from the disassembler-function), introducing
	a new objdump command line option?

Any help is much appreciated.

Greetings

Matthias



More information about the Binutils mailing list