assembling output of objdump dissassembly
Nick Clifton
nickc@redhat.com
Thu Oct 12 22:01:00 GMT 2006
Hi Arthur,
> It appears that the objdump output is quite similar to, but deliberately
> different from, the assembly created from compiling a c program with "gcc -S".
>
> Is there a mechanism to convert the objdump disassembly output to an
> assemblable form?
Apart from doing this by hand, no.
> Or is that a deliberate objdump decision to have the output
> different, as my desire is inherently unworkable,
It was a deliberate decision but the motive was to make disassembler's
output be useful to people who want to examine the contents of a binary
file, not to allow re-assembly. To this end, more information is
presented to the user than is needed to just re-assemble the
disassembled output.
> as modifying the disassembly
> would change all the branch offsets and cause everything to break?
No, the real problem is coping with relocations. The disassembled
output of a file is not just the textual disassembly, but also the
relocations that are associated with that disassembly. You would need
some way to re-install those relocations back into the assembler source,
possibly regenerating local labels as you go. A difficult task.
Cheers
Nick
More information about the Binutils
mailing list