This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Check bad symbol index in ia64 reloc
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 25 Sep 2003 09:29:12 +0930
- Subject: Re: PATCH: Check bad symbol index in ia64 reloc
- References: <20030923194930.GA23637@lucon.org><20030924021128.GO2768@bubble.sa.bigpond.net.au><20030924183348.GA12391@lucon.org>
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