This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: sparc testsuite failures
On Wed, Apr 14, 2004 at 07:18:19PM +0930, Alan Modra wrote:
> On Thu, Apr 08, 2004 at 07:01:08PM +0200, Christian Joensson wrote:
> > Alan's suggested patch makes the testsuite problem for PR 48 go away :)
>
> Applying mainline, with a similar fix for elf64-sparc.c. I'm
> reasonably confident this is OK for the branch too, but I'll leave
> that to Daniel and Jakub to sort out.
>
> * elf32-sparc.c (elf32_sparc_relocate_section): Don't abort
> when statically linking PIC code.
> * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
I think this is fine for 2.15. I certainly remember having to do the
same thing on ARM...
>
> Index: bfd/elf32-sparc.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
> retrieving revision 1.65
> diff -u -p -r1.65 elf32-sparc.c
> --- bfd/elf32-sparc.c 27 Mar 2004 10:58:07 -0000 1.65
> +++ bfd/elf32-sparc.c 14 Apr 2004 09:08:09 -0000
> @@ -2323,16 +2323,13 @@ elf32_sparc_relocate_section (output_bfd
> if (h == NULL)
> break;
>
> - if (h->plt.offset == (bfd_vma) -1)
> + if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL)
> {
> /* We didn't make a PLT entry for this symbol. This
> happens when statically linking PIC code, or when
> using -Bsymbolic. */
> break;
> }
> -
> - if (htab->splt == NULL)
> - abort ();
>
> relocation = (htab->splt->output_section->vma
> + htab->splt->output_offset
> Index: bfd/elf64-sparc.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
> retrieving revision 1.86
> diff -u -p -r1.86 elf64-sparc.c
> --- bfd/elf64-sparc.c 27 Mar 2004 10:58:07 -0000 1.86
> +++ bfd/elf64-sparc.c 14 Apr 2004 09:08:10 -0000
> @@ -2027,7 +2027,8 @@ sparc64_elf_relocate_section (output_bfd
> else
> got_base = elf_hash_table (info)->hgot->root.u.def.value;
>
> - sgot = splt = sreloc = NULL;
> + sgot = sreloc = NULL;
> + splt = bfd_get_section_by_name (dynobj, ".plt");
>
> rel = relocs;
> relend = relocs + NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr);
> @@ -2409,18 +2410,12 @@ sparc64_elf_relocate_section (output_bfd
> procedure linkage table. */
> BFD_ASSERT (h != NULL);
>
> - if (h->plt.offset == (bfd_vma) -1)
> + if (h->plt.offset == (bfd_vma) -1 || splt == NULL)
> {
> /* We didn't make a PLT entry for this symbol. This
> happens when statically linking PIC code, or when
> using -Bsymbolic. */
> goto do_default;
> - }
> -
> - if (splt == NULL)
> - {
> - splt = bfd_get_section_by_name (dynobj, ".plt");
> - BFD_ASSERT (splt != NULL);
> }
>
> relocation = (splt->output_section->vma
>
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer