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]
Other format: [Raw text]

Re: PATCH: Check bad symbol index in ia64 reloc


On Wed, Sep 24, 2003 at 11:33:48AM -0700, H. J. Lu wrote:
> 	* elflink.c (elf_link_read_relocs_from_section): Add an argument
> 	of a pointer to section. Check bad symbol index.
> 	(_bfd_elf_link_read_relocs): Modify calls to
> 	elf_link_read_relocs_from_section.

> +      r_symndx = (bfd_get_arch_size (abfd) == 32)
> +		  ? ELF32_R_SYM (irela->r_info)
> +		  : ELF64_R_SYM (irela->r_info);

This will generate warnings when only building for 32 bit hosts, and
it would be better without the bfd_get_arch_size call.

      r_symndx = ELF32_R_SYM (irela->r_info);
      if (bed->s->arch_size == 64)
	r_symndx >>= 24;

OK with the above.

Hmm, even better, test r_info directly against a maximum value
calculated outside of the loop.  If you go this way, you probably want
to simplify the error message by not reporting r_symndx and nsyms.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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