This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Return NULL on NULL bfd (Problem with linker with binutils-040414)
On Wed, Apr 21, 2004 at 11:57:46AM +0100, Nick Clifton wrote:
> >
> Well we can argue this back and forth all day. :-) I would say that the
> error message is not mangled but improved, coping not only with the
> detected error but also gracefully handling an internal error whilst
> still giving the user some informative output.
In this particular case, the error message is bogus. Improving a
bogus error message to avoid core dump and generate a potentially
bogus output is one step back.
>
> Perhaps the best compromise would be for bfd_archive_filename() to
> display its own error message (using _bfd_error_handler) when it is
> given a NULL input, but then to continue on and return NULL. That way
> the error handler will (presumably) stop the output from being
> generated, but bfd_archive_filename() will still execute so that the
> calling function will be able to display its error/warning message,
> which will further help to locate the problem that is plaguing the library.
>
I am not sure if _bfd_error_handler can be used to stop generating the
output. Maybe we can use the error_handler handler in linker. That
means we need to pass bfd_link_info to bfd_archive_filename. I still
prefer abort for its simplicity.
H.J.