[PATCH] readelf: Warn zero-sized relocation sections

Nick Clifton nickc@redhat.com
Mon Apr 20 10:28:34 GMT 2020


Hi Jan,

>>   I am of a mind to allow this patch, given that one of readelf's

> While I can see the "diagnose problems" aspect, zero-sized relocation
> sections aren't something the ELF standard disallows. So there's no
> problem with the ELF files in this case, just a _possible_ problem
> with consumers thereof.

True - but in this case we are talking about relocation sections, and
what possible use is an empty relocation section ?  Its presence is
legal sure, but it can also be an indication that the tool that created
the binary is not quite doing its job properly.

I personally like the idea of giving users as much information as possible
and allowing them to decide if they want it.  After all it is relatively
easy to remove any warning out that is undesired via command line tools.


>>     readelf: Warning: Section '.rela.dyn': zero-sized relocation section
> 
> Aren't these a good enough indication that zero-sized relocation
> sections aren't this unusual, and hence a default-on warning is
> going too far?

Actually no - these failures have now prompted H.J. and Alan to have a look
at the code producing these empty sections and see about fixing them.

Cheers
  Nick




More information about the Binutils mailing list