This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Fix ld segfaults under hppa64-hp-hpux11
- From: law at redhat dot com
- To: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: binutils at sources dot redhat dot com, ross dot alexander at uk dot neceur dot com, amodra at bigpond dot net dot au
- Date: Wed, 12 Jun 2002 12:16:03 -0600
- Subject: Re: Fix ld segfaults under hppa64-hp-hpux11
- Reply-to: law at redhat dot com
In message <200206121643.g5CGhbA6026228@hiauly1.hia.nrc.ca>, "John David Anglin
" writes:
> The enclosed patch fixes the two problems noted by Ross Alexander in this
> message <http://sources.redhat.com/ml/binutils/2002-06/msg00029.html>.
>
> PROBLEM 1 - BUILDING SHARED LIBRARIES WITH UNDEFINED FUNCTION REFERENCES
>
> This was the more complicated of the two. The problem was we were trying
> to create an opd for "f1" when linking libtest2.sl when we shouldn't.
> f1 is not defined in libtest2.sl (it is defined in libtest1.sl) so we
> shouldn't try to create an opd entry for it when we link libtest2.sl.
> Thus, I changed allocate_global_data_opd to not request an opd entry
> when a symbol has no output section. This fixed the segfault but a
> simple application linked against libtest2.sl segfaulted when a call
> with (*r1) was performed. A check to see if we want an opd entry
> needed to be added to elf64_hppa_finalize_dynreloc to fix this problem.
>
> PROBLEM 2 - BUILDING EXECUTABLE WITH UNDEFINED FUNCTION REFERENCE
>
> We probably shouldn't be creating a dlt entry for an undefined function
> reference. However, since an error condition has already occurred,
> I simply added a check to see if the section pointer for the symbol
> was not NULL to prevent the segfault.
>
> I have tested the patch on Ross's two examples. I have also tested
> the patch with a rebuild of binutils and gcc on hppa64-hp-hpux11.00.
>
> Please install if OK.
>
> Dave
> --
> J. David Anglin dave.anglin@nrc.ca
> National Research Council of Canada (613) 990-0752 (FAX: 952-66
> 05)
>
> 2002-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
>
> * elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry
> for a symbol that has no output section.
> (allocate_dynrel_entries): Correct comment.
> (elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry
> unless we want one.
> (elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
> (elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols
> with no section. Remove unnecessary parentheses.
Thanks. Installed.
jeff