This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix for readelf hex-dump SHT_NOBITS bug


On Thu, Oct 30, 2003 at 10:12:08AM +0000, Nick Clifton wrote:
> 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 ?

What do you mean by "non-zero-sized"?  The size of a NOBITS section is
normally the size of the memory that should be allocated to it, and it
takes up no file space.  Readelf dumps garbage from the following
section (and confused me to no end the last time I noticed this).

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]