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 Tue, Apr 20, 2004 at 04:17:00PM +0100, Nick Clifton wrote:
> Hi H. J.
>
> >I am having the second thought. bfd_archive_filename was invented for
> >bfd error reporting. It is used as
> >
> >
>
> Surely if it is intended for error reporting then it is better that it
> returns a bogus filename such as "<unknown>" rather than seg-faulting as
> otherwise the actual error message will never be displayed.
>
From
http://sources.redhat.com/ml/binutils/2004-04/msg00274.html
If bfd_archive_filename returns NULL, you will get
---
I have confirmed that on line 3637 of elflink.c, old_bfd is null and thus
the call to bfd_archive_filename cores. If I have that method return 0
if abfd is null, it no longer core dumps. Instead, I get warnings:
/usr/bin/ld: Warning: size of symbol `getpwuid_r@GLIBC_2.0' changed from
385 in (null) to 392 in /lib/libc.so.6
/usr/bin/ld: Warning: size of symbol `getrlimit@GLIBC_2.0' changed from 59
in (null) to 58 in /lib/libc.so.6
/usr/bin/ld: Warning: size of symbol `realpath@GLIBC_2.0' changed from 54
in (null) to 64 in /lib/libc.so.6
---
If people don't scan linker warnings for regression, which I usually
don't, we may not uncover the linker bug for a long time. In this
case, segfault saved us.
H.J.