This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: Zero out the allocated dynamic content space.


On Fri, Aug 18, 2000 at 08:14:22AM -0700, Ian Lance Taylor wrote:
>    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.
> 

I have no arguments with that. But as Alan has pointed out, it is not
an easy job to do. I certainly don't have the time. It is very
interesting to see many ELF targets use bfd_zalloc in that particular
place. I will check my patch into my local tree and I will back them
out when a real fix is checked into sourceware.

-- 
H.J. Lu (hjl@gnu.org)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]