[PATCH] readelf: Warn zero-sized relocation sections

Jan Beulich jbeulich@suse.com
Fri Apr 24 17:50:04 GMT 2020


On 24.04.2020 16:04, Nick Clifton wrote:
> Hi Guys,
> 
>   OK, here is a first draft of a patch to implement a checking mode
>   for readelf.  It incorporates H.J.'s zero-size section test, although
>   I have extended it to cover any SHT_PROGBITS section as well.  (Mainly
>   because it makes writing a test case much easier).
> 
>   One thing that the patch does not do, but which maybe it should, is
>   disable the normal non-warning output when the checking mode is enabled.
>   The effect can be achieved by redirecting stdout to the null device
>   of course, but I appreciate that this is not always possible/easy to do.
> 
>   Anyway - comments ?

Well, as said before, and as now supported by another reply
you've got, I'm unconvinced warning about empty .text or
.data in particular, but perhaps @progbits / @qnobits in
general is helpful behavior. Especially not as long as gas
created such files without there being a way to prevent it
doing so.

Apart from that, besides noticing a few seemingly unrelated
changes, is __attribute__((weak)) portable enough to be used
in binutils? (Sorry, didn't check if there are pre-existing
instances.)

Jan


More information about the Binutils mailing list