From 21a8f7fa66f0a6487f82b170d45cd55d9235f81a Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Wed, 30 Jun 2004 20:23:23 +0000 Subject: [PATCH] Fix @pltoff linker segfault for non-shared link. * 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 | 5 +++++ bfd/elfxx-ia64.c | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 464821d..11bed97 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-06-30 James E Wilson + + * 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 PR 233 diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index d8c4b57..37b0d24 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -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) -- 2.7.4