This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: More rel/rela fixes for ld -r
- From: Alan Modra <amodra at gmail dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: binutils at sources dot redhat dot com, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Mon, 4 Oct 2010 18:39:41 +1030
- Subject: Re: More rel/rela fixes for ld -r
- References: <4CA1DFA8.6050102@codesourcery.com> <20100929114823.GZ16376@bubble.grove.modra.org> <4CA32BF4.1090600@codesourcery.com> <20100929151022.GA16376@bubble.grove.modra.org> <4CA61C58.5010302@codesourcery.com>
On Fri, Oct 01, 2010 at 07:37:28PM +0200, Bernd Schmidt wrote:
> * elf64-ppc accesses an uninitialized rel_hdr structure in get_relocs.
I don't think so. The rel_hdr in question is allocated along with
elf_section_data, and zeroed.
> This happens for brlt and stub sections which the backend creates.
> I've changed it to simply allocate memory for rela.hdr; the
> testcase worked after this change.
Please use bfd_zalloc.
I also see
bfd/elflink.c: In function âelf_reloc_link_orderâ:
bfd/elflink.c:9875: error: âreldataâ may be used uninitialized in this function
bfd/elflink.c: In function âelf_link_input_bfdâ:
bfd/elflink.c:9555: error: ârela_hash_listâ may be used uninitialized in this function
> ! Elf_Internal_Shdr *
> ! _bfd_elf_single_rel_hdr (asection *sec)
> ! {
> ! if (elf_section_data (sec)->rel.hdr)
> ! {
> ! BFD_ASSERT (elf_section_data (sec)->rela.hdr == NULL);
> ! return elf_section_data (sec)->rel.hdr;
> ! }
> ! else
> ! {
> ! BFD_ASSERT (elf_section_data (sec)->rel.hdr == NULL);
> ! return elf_section_data (sec)->rela.hdr;
> ! }
> ! }
The second assert here is a little useless. Otherwise, I think the
patch is OK.
--
Alan Modra
Australia Development Lab, IBM