This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Patch: Zero out the allocated dynamic content space.
- To: hjl at valinux dot com
- Subject: Re: Patch: Zero out the allocated dynamic content space.
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 18 Aug 2000 08:14:22 -0700
- CC: binutils at sourceware dot cygnus dot com
- References: <20000818001431.A8080@valinux.com>
Date: Fri, 18 Aug 2000 00:14:31 -0700
From: "H . J . Lu" <hjl@valinux.com>
# make
ld -shared -o test.so --version-script=test.map rtld.os setjmp.os
readelf -r test.so | head -5
Relocation section '.rel.text' at offset 0xcbc contains 1 entries:
Offset Info Type Symbol's Value Symbol's Name
00000609 01c84 unrecognised: 84 00000000 _dl_debug_fd
"unrecognised: 84" is caused by bfd_alloc, which leaves s->contents
uninitialized in certain cases. Most of the ELF targets use bfd_zalloc
instead of bfd_alloc for s->contents. I think all ELF targets should
use bfd_zalloc. At least, it fixes Linux/ia32:
This is an argument we have had many times before. You have found a
bug. Using bfd_zalloc fixes the symptoms by hiding the bug. It does
not fix the bug. I think it is better to fix the bug than to fix the
symptoms.
In programming I can think of only one possible reason to fix the
symptoms rather than to fix the bug: because you must make release the
code immediately, and you are very pressed for time. That reason does
not apply in this case. Even if it did, it would only be appropriate
to fix the symptoms on the release branch. In the real sources, we
should fix the actual bug.
Ian