objdump -d / -D behavior

Nick Clifton nickc@redhat.com
Mon Oct 10 08:37:00 GMT 2005


Hi Bryce,

> I'm a bit cunfused about the relative behavior of objdump -d vs.
> objdump -D. It seems like the implementation is not what the user
> would want (read: not what I want). When I use -d, the disassembler is
> smart enough not to disassemble non-executable objects, but instead
> does a hex dump. When I use -D (because I want to include all sections
> in the disassembly), it loses this intelligence. I see no reason why
> this should be necessary, 

The point of the -D switch is that it is intended to be used when the 
assumption about "only non-empty, executable sections contain code" is 
not valid.  In this case objdump has to assume that the file it is 
disassembling is special in some way and that it cannot make any 
assumptions about which sections do or do not contain code.

There do exist programs which for example contain co-processor code in 
non-executable but loadable sections which the user may want to see 
disassembled.

> or at least if it is necessary to force
> disassembly of all data, to have an option that does include sections
> with no executable, AND does a hex dump of non-executable sections /
> objects.

Have you tried the "-s" switch ?

This will give you hex dumps of the non-executable sections, but it will 
also dump the executable sections which may not be what you want.  Of 
course you can always write a patch to give you exactly the features you 
want.

Cheers
   Nick



More information about the Binutils mailing list