This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld is broken on ia64
On Mon, Nov 19, 2001 at 05:48:00PM +1030, Alan Modra wrote:
> On Sun, Nov 18, 2001 at 10:59:38PM -0800, H . J . Lu wrote:
> >
> > Are you sure under no other conditions r_symndx will be 0?
>
> The only case I know of is a relocation that has no symbol, which is an
> unusual situation for a relocatable object file. It can happen, eg.
> R_PPC64_TOC, but not for any of the R_IA64_SEGREL* relocs.
>
> > Won't that
> > make relocations against undefined symbols ok?
>
> No. If you have a symbol, it won't have an index of zero.
If it is true, I'd like to have some assurances. How about this patch?
H.J.
----
2001-11-19 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_input_bfd): Assert r_symndx != 0 when
discarding relocations.
--- bfd/elflink.h.discard Fri Nov 16 11:47:19 2001
+++ bfd/elflink.h Mon Nov 19 06:55:08 2001
@@ -6509,6 +6509,7 @@ elf_link_input_bfd (finfo, input_bfd)
_("warning: relocation against removed section; zeroing"),
NULL, input_bfd, o, rel->r_offset);
#endif
+ BFD_ASSERT (r_symndx != 0);
memset (rel, 0, sizeof (*rel));
}
else
@@ -6540,6 +6541,7 @@ elf_link_input_bfd (finfo, input_bfd)
_("warning: relocation against removed section"),
NULL, input_bfd, o, rel->r_offset);
#endif
+ BFD_ASSERT (r_symndx != 0);
rel->r_info
= ELF_R_INFO (0, ELF_R_TYPE (rel->r_info));
rel->r_addend = 0;