Fix @pltoff linker segfault for non-shared link.
authorJim Wilson <wilson@tuliptree.org>
Wed, 30 Jun 2004 20:23:23 +0000 (20:23 +0000)
committerJim Wilson <wilson@tuliptree.org>
Wed, 30 Jun 2004 20:23:23 +0000 (20:23 +0000)
* elfxx-ia64.c (elfNN_ia64_check_relocs): New local pltoff.  Initialize
to NULL.  Call get_pltoff if NULL and NEED_PLTOFF is true.

bfd/ChangeLog
bfd/elfxx-ia64.c

index 464821d..11bed97 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-30  James E Wilson  <wilson@specifixinc.com>
+
+       * elfxx-ia64.c (elfNN_ia64_check_relocs): New local pltoff.  Initialize
+       to NULL.  Call get_pltoff if NULL and NEED_PLTOFF is true.
+
 2004-06-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR 233
index d8c4b57..37b0d24 100644 (file)
@@ -2248,7 +2248,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
   const Elf_Internal_Rela *relend;
   Elf_Internal_Shdr *symtab_hdr;
   const Elf_Internal_Rela *rel;
-  asection *got, *fptr, *srel;
+  asection *got, *fptr, *srel, *pltoff;
 
   if (info->relocatable)
     return TRUE;
@@ -2256,7 +2256,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   ia64_info = elfNN_ia64_hash_table (info);
 
-  got = fptr = srel = NULL;
+  got = fptr = srel = pltoff = NULL;
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; ++rel)
@@ -2507,7 +2507,18 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
       if (need_entry & NEED_FULL_PLT)
        dyn_i->want_plt2 = 1;
       if (need_entry & NEED_PLTOFF)
-       dyn_i->want_pltoff = 1;
+       {
+         /* This is needed here, in case @pltoff is used in a non-shared
+            link.  */
+         if (!pltoff)
+           {
+             pltoff = get_pltoff (abfd, info, ia64_info);
+             if (!pltoff)
+               return FALSE;
+           }
+         
+         dyn_i->want_pltoff = 1;
+       }
       if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC))
        {
          if (!srel)