This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: More rel/rela fixes for ld -r


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


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