[PATCH] elflint: Always print symbol name (if known) in error messages.

Mark Wielaard mark@klomp.org
Tue Dec 15 22:53:48 GMT 2020


Hi Dmitry,

On Wed, Dec 16, 2020 at 12:44:05AM +0300, Dmitry V. Levin wrote:
> This is nice, thanks.
> I have one question about the patch:
> 
> [...]
> > --- a/src/elflint.c
> > +++ b/src/elflint.c
> > @@ -706,7 +706,7 @@ section [%2d] '%s': XINDEX for zeroth entry not zero\n"),
> >  	  continue;
> >  	}
> >  
> > -      const char *name = NULL;
> > +      const char *name = "<invalid>";
> 
> This variable is used in some checks, for example, it's being passed
> to ebl_check_special_symbol.  I'd like to make sure this change
> doesn't have any unintended consequences.

Good question. I assumed it was ok, but double checked.  It is used by
ebl_check_special_symbol and various strcmps.  The strcmps would
actually have crashed if the name was NULL (all backends that
implement check_special_symbol did handle NULL first before calling
strcmp). Since "<invalid>" isn't a valid symbol name (the '<' and '>'
are not normally used) it is fine in all places that use name to check
against a valid symbol name.

Cheers,

Mark


More information about the Elfutils-devel mailing list