This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Linking libstdc++ with gcc-3.0.2 prerelease fails on IA64
On Mon, Oct 15, 2001 at 08:23:13PM -0700, H . J . Lu wrote:
> On Tue, Oct 16, 2001 at 11:46:18AM +0930, Alan Modra wrote:
> > On Mon, Oct 15, 2001 at 06:23:12PM -0700, H . J . Lu wrote:
> > >
> > > * elflink.h (elf_link_input_bfd): Set type to BFD_RELOC_NONE
> > > for relocations against discarded link-once section.
> > >
> > > --- elflink.h.weak Mon Oct 15 16:51:51 2001
> > > +++ elflink.h Mon Oct 15 17:02:03 2001
> > > @@ -6327,8 +6327,10 @@ elf_link_input_bfd (finfo, input_bfd)
> > > && (sec->flags & SEC_LINK_ONCE) != 0
> > > && bfd_is_abs_section (sec->output_section))
> > > {
> > > - long r_type = ELF_R_TYPE (rel->r_info);
> > > - rel->r_info = ELF_R_INFO (0, r_type);
> > > + reloc_howto_type *howto
> > > + = bfd_reloc_type_lookup (output_bfd,
> > > + BFD_RELOC_NONE);
> > > + rel->r_info = ELF_R_INFO (0, howto->type);
> > >
> > > #if BFD_VERSION_DATE > 20021005
> > > (*finfo->info->callbacks->warning)
> >
> > Hmm, I wondered whether I was doing the right thing leaving the relocation
> > type as it was. Why not just do
> >
> > rel->r_info = 0;
> >
> > After all, we rely on R_*_NONE being zero in other places. In fact, it's
> > probably safest to zero the entire reloc, like this:
> >
>
> I believe we should look up BFD_RELOC_NONE and set r_info only with
> ELF_R_INFO. But I don't have a strong opinion on that. I only want to
> stabilize the linker.
>
>
Here is one I prefer.
H.J.
--- elflink.h.weak Mon Oct 15 16:51:51 2001
+++ elflink.h Mon Oct 15 19:25:30 2001
@@ -6078,6 +6078,8 @@ elf_link_input_bfd (finfo, input_bfd)
asection *o;
struct elf_backend_data *bed;
boolean emit_relocs;
+ reloc_howto_type *none_howto;
+ bfd_vma none_r_info;
output_bfd = finfo->output_bfd;
bed = get_elf_backend_data (output_bfd);
@@ -6249,6 +6251,9 @@ elf_link_input_bfd (finfo, input_bfd)
return false;
}
+ none_howto = bfd_reloc_type_lookup (output_bfd, BFD_RELOC_NONE);
+ none_r_info = ELF_R_INFO (0, none_howto->type);
+
/* Relocate the contents of each section. */
for (o = input_bfd->sections; o != NULL; o = o->next)
{
@@ -6327,8 +6332,7 @@ elf_link_input_bfd (finfo, input_bfd)
&& (sec->flags & SEC_LINK_ONCE) != 0
&& bfd_is_abs_section (sec->output_section))
{
- long r_type = ELF_R_TYPE (rel->r_info);
- rel->r_info = ELF_R_INFO (0, r_type);
+ rel->r_info = none_r_info;
#if BFD_VERSION_DATE > 20021005
(*finfo->info->callbacks->warning)