[PATCH] Fix for readelf hex-dump SHT_NOBITS bug

Nick Clifton nickc@redhat.com
Thu Oct 30 10:21:00 GMT 2003


Hi Marshall,

> Several days without comment or commit...  Did I violate some sort
> of patch-submitting taboo?

Nope - we are just busy is all.  Please remember that this list is
handled by volunteers who have other things to do as well.

> This looks like an obvious fix to me.  Currently, `readelf
> --hex-dump' on a SHT_NOBITS section will attempt to dump the
> section's sh_size bytes from the file (failing cleanly if the file
> is too small).  This patch makes it treat SHT_NOBITS sections as
> zero bytes in size.

Well in principle this seems like a good idea, but in practice I am
not sure that it is.  One of the purposes of the readelf tool is to be
able to display the contents of malformed ELF files in order to help
debugging.  Thus refusing to dump the contents of a non-zero sized
SHT_NOBITS section might not be such a good idea.  What if the
SHT_NOBITS attribute had been erroneously applied to the section ?

I think that it might be better to issue a warning message along the
lines of "dumping the contents of section <foo> despite the fact that
it has the SHT_NOBITS attribute".  What do you think ?

Cheers
        Nick



More information about the Binutils mailing list