* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Use info->executable
[deliverable/binutils-gdb.git] / bfd / elf-hppa.h
index f3727466015a2893cf0ac3acfef06931c9e18eca..c4ad5ad712e184979e327418e88fa1e42b693711 100644 (file)
@@ -1,5 +1,6 @@
 /* Common code for PA ELF implementations.
-   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -15,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #define ELF_HOWTO_TABLE_SIZE       R_PARISC_UNIMPLEMENTED + 1
 
@@ -31,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
 #define elf_hppa_relocate_section elf64_hppa_relocate_section
-#define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
 #define elf_hppa_final_link elf64_hppa_final_link
 #endif
 #if ARCH_SIZE == 32
@@ -40,66 +40,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
 #define elf_hppa_relocate_section elf32_hppa_relocate_section
-#define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
 #define elf_hppa_final_link elf32_hppa_final_link
 #endif
 
-static void elf_hppa_info_to_howto
-  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-
-static void elf_hppa_info_to_howto_rel
-  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
-
-static reloc_howto_type * elf_hppa_reloc_type_lookup
-  PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-static bfd_boolean elf_hppa_is_local_label_name
-  PARAMS ((bfd *, const char *));
-
-static bfd_boolean elf_hppa_fake_sections
-  PARAMS ((bfd *abfd, Elf_Internal_Shdr *, asection *));
-
-static void elf_hppa_final_write_processing
-  PARAMS ((bfd *, bfd_boolean));
-
-static int hppa_unwind_entry_compare
-  PARAMS ((const PTR, const PTR));
-
-static bfd_boolean elf_hppa_sort_unwind
-  PARAMS ((bfd *));
-
 #if ARCH_SIZE == 64
-static bfd_boolean elf_hppa_add_symbol_hook
-  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
-          const char **, flagword *, asection **, bfd_vma *));
-
-static bfd_boolean elf_hppa_unmark_useless_dynamic_symbols
-  PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean elf_hppa_remark_useless_dynamic_symbols
-  PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean elf_hppa_is_dynamic_loader_symbol
-  PARAMS ((const char *));
-
-static void elf_hppa_record_segment_addrs
-  PARAMS ((bfd *, asection *, PTR));
-
-static bfd_boolean elf_hppa_final_link
-  PARAMS ((bfd *, struct bfd_link_info *));
-
-static bfd_boolean elf_hppa_relocate_section
-  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
-          bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-
 static bfd_reloc_status_type elf_hppa_final_link_relocate
-  PARAMS ((Elf_Internal_Rela *, bfd *, bfd *, asection *,
-          bfd_byte *, bfd_vma, struct bfd_link_info *,
-          asection *, struct elf_link_hash_entry *,
-          struct elf64_hppa_dyn_hash_entry *));
+  (Elf_Internal_Rela *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma,
+   struct bfd_link_info *, asection *, struct elf_link_hash_entry *,
+   struct elf64_hppa_dyn_hash_entry *);
 
 static int elf_hppa_relocate_insn
-  PARAMS ((int, int, unsigned int));
+  (int, int, unsigned int);
 #endif
 
 /* ELF/PA relocation howto entries.  */
@@ -615,11 +566,10 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
    format, and field selector.  */
 
 elf_hppa_reloc_type
-elf_hppa_reloc_final_type (abfd, base_type, format, field)
-     bfd *abfd;
-     elf_hppa_reloc_type base_type;
-     int format;
-     unsigned int field;
+elf_hppa_reloc_final_type (bfd *abfd,
+                          elf_hppa_reloc_type base_type,
+                          int format,
+                          unsigned int field)
 {
   elf_hppa_reloc_type final_type = base_type;
 
@@ -861,6 +811,28 @@ elf_hppa_reloc_final_type (abfd, base_type, format, field)
            }
          break;
 
+       case 32:
+         switch (field)
+           {
+           case e_fsel:
+             final_type = R_PARISC_PCREL32;
+             break;
+           default:
+             return R_PARISC_NONE;
+           }
+         break;
+
+       case 64:
+         switch (field)
+           {
+           case e_fsel:
+             final_type = R_PARISC_PCREL64;
+             break;
+           default:
+             return R_PARISC_NONE;
+           }
+         break;
+
        default:
          return R_PARISC_NONE;
        }
@@ -884,26 +856,25 @@ elf_hppa_reloc_final_type (abfd, base_type, format, field)
    relocation with modifications based on format and field.  */
 
 elf_hppa_reloc_type **
-_bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
-     bfd *abfd;
-     elf_hppa_reloc_type base_type;
-     int format;
-     unsigned int field;
-     int ignore ATTRIBUTE_UNUSED;
-     asymbol *sym ATTRIBUTE_UNUSED;
+_bfd_elf_hppa_gen_reloc_type (bfd *abfd,
+                             elf_hppa_reloc_type base_type,
+                             int format,
+                             unsigned int field,
+                             int ignore ATTRIBUTE_UNUSED,
+                             asymbol *sym ATTRIBUTE_UNUSED)
 {
   elf_hppa_reloc_type *finaltype;
   elf_hppa_reloc_type **final_types;
   bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
 
   /* Allocate slots for the BFD relocation.  */
-  final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt);
+  final_types = bfd_alloc (abfd, amt);
   if (final_types == NULL)
     return NULL;
 
   /* Allocate space for the relocation itself.  */
   amt = sizeof (elf_hppa_reloc_type);
-  finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt);
+  finaltype = bfd_alloc (abfd, amt);
   if (finaltype == NULL)
     return NULL;
 
@@ -919,12 +890,11 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
 /* Translate from an elf into field into a howto relocation pointer.  */
 
 static void
-elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     arelent *bfd_reloc;
-     Elf_Internal_Rela *elf_reloc;
+elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
+                       arelent *bfd_reloc,
+                       Elf_Internal_Rela *elf_reloc)
 {
-  BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
+  BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
              < (unsigned int) R_PARISC_UNIMPLEMENTED);
   bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
 }
@@ -932,10 +902,9 @@ elf_hppa_info_to_howto (abfd, bfd_reloc, elf_reloc)
 /* Translate from an elf into field into a howto relocation pointer.  */
 
 static void
-elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     arelent *bfd_reloc;
-     Elf_Internal_Rela *elf_reloc;
+elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
+                           arelent *bfd_reloc,
+                           Elf_Internal_Rela *elf_reloc)
 {
   BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
              < (unsigned int) R_PARISC_UNIMPLEMENTED);
@@ -946,9 +915,8 @@ elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
    relocation for an ARCH machine.  */
 
 static reloc_howto_type *
-elf_hppa_reloc_type_lookup (abfd, code)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     bfd_reloc_code_real_type code;
+elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                           bfd_reloc_code_real_type code)
 {
   if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
     {
@@ -961,9 +929,7 @@ elf_hppa_reloc_type_lookup (abfd, code)
 /* Return TRUE if SYM represents a local label symbol.  */
 
 static bfd_boolean
-elf_hppa_is_local_label_name (abfd, name)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     const char *name;
+elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
 {
   if (name[0] == 'L' && name[1] == '$')
     return 1;
@@ -974,12 +940,9 @@ elf_hppa_is_local_label_name (abfd, name)
    section name, which is a hack, but ought to work.  */
 
 static bfd_boolean
-elf_hppa_fake_sections (abfd, hdr, sec)
-     bfd *abfd;
-     Elf_Internal_Shdr *hdr;
-     asection *sec;
+elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
 {
-  register const char *name;
+  const char *name;
 
   name = bfd_get_section_name (abfd, sec);
 
@@ -1017,9 +980,8 @@ elf_hppa_fake_sections (abfd, hdr, sec)
 }
 
 static void
-elf_hppa_final_write_processing (abfd, linker)
-     bfd *abfd;
-     bfd_boolean linker ATTRIBUTE_UNUSED;
+elf_hppa_final_write_processing (bfd *abfd,
+                                bfd_boolean linker ATTRIBUTE_UNUSED)
 {
   int mach = bfd_get_mach (abfd);
 
@@ -1048,20 +1010,18 @@ elf_hppa_final_write_processing (abfd, linker)
    final link.  */
 
 static int
-hppa_unwind_entry_compare (a, b)
-     const PTR a;
-     const PTR b;
+hppa_unwind_entry_compare (const void *a, const void *b)
 {
   const bfd_byte *ap, *bp;
   unsigned long av, bv;
 
-  ap = (const bfd_byte *) a;
+  ap = a;
   av = (unsigned long) ap[0] << 24;
   av |= (unsigned long) ap[1] << 16;
   av |= (unsigned long) ap[2] << 8;
   av |= (unsigned long) ap[3];
 
-  bp = (const bfd_byte *) b;
+  bp = b;
   bv = (unsigned long) bp[0] << 24;
   bv |= (unsigned long) bp[1] << 16;
   bv |= (unsigned long) bp[2] << 8;
@@ -1070,8 +1030,7 @@ hppa_unwind_entry_compare (a, b)
   return av < bv ? -1 : av > bv ? 1 : 0;
 }
 
-static bfd_boolean elf_hppa_sort_unwind (abfd)
-     bfd *abfd;
+static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
 {
   asection *s;
 
@@ -1083,16 +1042,12 @@ static bfd_boolean elf_hppa_sort_unwind (abfd)
   if (s != NULL)
     {
       bfd_size_type size;
-      char *contents;
+      bfd_byte *contents;
 
-      size = s->_raw_size;
-      contents = bfd_malloc (size);
-      if (contents == NULL)
-       return FALSE;
-
-      if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size))
+      if (!bfd_malloc_and_get_section (abfd, s, &contents))
        return FALSE;
 
+      size = s->size;
       qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);
 
       if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
@@ -1102,20 +1057,31 @@ static bfd_boolean elf_hppa_sort_unwind (abfd)
   return TRUE;
 }
 
+/* What to do when ld finds relocations against symbols defined in
+   discarded sections.  */
+
+static unsigned int
+elf_hppa_action_discarded (asection *sec)
+{
+  if (strcmp (".PARISC.unwind", sec->name) == 0)
+    return 0;
+
+  return _bfd_elf_default_action_discarded (sec);
+}
+
 #if ARCH_SIZE == 64
 /* Hook called by the linker routine which adds symbols from an object
    file.  HP's libraries define symbols with HP specific section
    indices, which we have to handle.  */
 
 static bfd_boolean
-elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
-     bfd *abfd;
-     struct bfd_link_info *info ATTRIBUTE_UNUSED;
-     const Elf_Internal_Sym *sym;
-     const char **namep ATTRIBUTE_UNUSED;
-     flagword *flagsp ATTRIBUTE_UNUSED;
-     asection **secp;
-     bfd_vma *valp;
+elf_hppa_add_symbol_hook (bfd *abfd,
+                         struct bfd_link_info *info ATTRIBUTE_UNUSED,
+                         Elf_Internal_Sym *sym,
+                         const char **namep ATTRIBUTE_UNUSED,
+                         flagword *flagsp ATTRIBUTE_UNUSED,
+                         asection **secp,
+                         bfd_vma *valp)
 {
   int index = sym->st_shndx;
 
@@ -1138,11 +1104,10 @@ elf_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
 }
 
 static bfd_boolean
-elf_hppa_unmark_useless_dynamic_symbols (h, data)
-     struct elf_link_hash_entry *h;
-     PTR data;
+elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
+                                        void *data)
 {
-  struct bfd_link_info *info = (struct bfd_link_info *)data;
+  struct bfd_link_info *info = data;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -1160,25 +1125,23 @@ elf_hppa_unmark_useless_dynamic_symbols (h, data)
      Ultimately we should have better controls over the generic ELF BFD
      linker code.  */
   if (! info->relocatable
-      && ! (info->shared
-           && !info->no_undefined)
+      && info->unresolved_syms_in_shared_libs != RM_IGNORE
       && h->root.type == bfd_link_hash_undefined
-      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
-      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
+      && h->ref_dynamic
+      && !h->ref_regular)
     {
-      h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC;
-      h->elf_link_hash_flags |= 0x8000;
+      h->ref_dynamic = 0;
+      h->pointer_equality_needed = 1;
     }
 
   return TRUE;
 }
 
 static bfd_boolean
-elf_hppa_remark_useless_dynamic_symbols (h, data)
-     struct elf_link_hash_entry *h;
-     PTR data;
+elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
+                                        void *data)
 {
-  struct bfd_link_info *info = (struct bfd_link_info *)data;
+  struct bfd_link_info *info = data;
 
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -1188,7 +1151,7 @@ elf_hppa_remark_useless_dynamic_symbols (h, data)
      the generic code will warn that it is undefined.
 
      This behavior is undesirable on HPs since the standard shared
-     libraries contain reerences to undefined symbols.
+     libraries contain references to undefined symbols.
 
      So we twiddle the flags associated with such symbols so that they
      will not trigger the warning.  ?!? FIXME.  This is horribly fragile.
@@ -1196,23 +1159,21 @@ elf_hppa_remark_useless_dynamic_symbols (h, data)
      Ultimately we should have better controls over the generic ELF BFD
      linker code.  */
   if (! info->relocatable
-      && ! (info->shared
-           && !info->no_undefined)
+      && info->unresolved_syms_in_shared_libs != RM_IGNORE
       && h->root.type == bfd_link_hash_undefined
-      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
-      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
-      && (h->elf_link_hash_flags & 0x8000) != 0)
+      && !h->ref_dynamic
+      && !h->ref_regular
+      && h->pointer_equality_needed)
     {
-      h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
-      h->elf_link_hash_flags &= ~0x8000;
+      h->ref_dynamic = 1;
+      h->pointer_equality_needed = 0;
     }
 
   return TRUE;
 }
 
 static bfd_boolean
-elf_hppa_is_dynamic_loader_symbol (name)
-     const char * name;
+elf_hppa_is_dynamic_loader_symbol (const char *name)
 {
   return (! strcmp (name, "__CPU_REVISION")
          || ! strcmp (name, "__CPU_KEYBITS_1")
@@ -1229,15 +1190,14 @@ elf_hppa_is_dynamic_loader_symbol (name)
 
 /* Record the lowest address for the data and text segments.  */
 static void
-elf_hppa_record_segment_addrs (abfd, section, data)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *section;
-     PTR data;
+elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
+                              asection *section,
+                              void *data)
 {
   struct elf64_hppa_link_hash_table *hppa_info;
   bfd_vma value;
 
-  hppa_info = (struct elf64_hppa_link_hash_table *)data;
+  hppa_info = data;
 
   value = section->vma - section->filepos;
 
@@ -1258,9 +1218,7 @@ elf_hppa_record_segment_addrs (abfd, section, data)
    fall back to the generic ELF final link routine.  */
 
 static bfd_boolean
-elf_hppa_final_link (abfd, info)
-     bfd *abfd;
-     struct bfd_link_info *info;
+elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
 {
   bfd_boolean retval;
   struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
@@ -1313,9 +1271,9 @@ elf_hppa_final_link (abfd, info)
              if (!sec || (sec->flags & SEC_EXCLUDE))
                sec = bfd_get_section_by_name (abfd, ".data");
              if (!sec || (sec->flags & SEC_EXCLUDE))
-               return FALSE;
-
-             gp_val = sec->output_offset + sec->output_section->vma;
+               gp_val = 0;
+             else
+               gp_val = sec->output_offset + sec->output_section->vma;
            }
        }
 
@@ -1330,7 +1288,7 @@ elf_hppa_final_link (abfd, info)
   hppa_info->data_segment_base = (bfd_vma)-1;
 
   /* HP's shared libraries have references to symbols that are not
-     defined anywhere.  The generic ELF BFD linker code will complaim
+     defined anywhere.  The generic ELF BFD linker code will complain
      about such symbols.
 
      So we detect the losing case and arrange for the flags on the symbol
@@ -1343,7 +1301,7 @@ elf_hppa_final_link (abfd, info)
                          info);
 
   /* Invoke the regular ELF backend linker to do all the work.  */
-  retval = bfd_elf_bfd_final_link (abfd, info);
+  retval = bfd_elf_final_link (abfd, info);
 
   elf_link_hash_traverse (elf_hash_table (info),
                          elf_hppa_remark_useless_dynamic_symbols,
@@ -1360,16 +1318,14 @@ elf_hppa_final_link (abfd, info)
 /* Relocate an HPPA ELF section.  */
 
 static bfd_boolean
-elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
-                          contents, relocs, local_syms, local_sections)
-     bfd *output_bfd;
-     struct bfd_link_info *info;
-     bfd *input_bfd;
-     asection *input_section;
-     bfd_byte *contents;
-     Elf_Internal_Rela *relocs;
-     Elf_Internal_Sym *local_syms;
-     asection **local_sections;
+elf_hppa_relocate_section (bfd *output_bfd,
+                          struct bfd_link_info *info,
+                          bfd *input_bfd,
+                          asection *input_section,
+                          bfd_byte *contents,
+                          Elf_Internal_Rela *relocs,
+                          Elf_Internal_Sym *local_syms,
+                          asection **local_sections)
 {
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *rel;
@@ -1394,7 +1350,6 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
       asection *sym_sec;
       bfd_vma relocation;
       bfd_reloc_status_type r;
-      const char *sym_name;
       const char *dyn_name;
       char *dynh_buf = NULL;
       size_t dynh_buflen = 0;
@@ -1417,11 +1372,11 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
          /* This is a local symbol.  */
          sym = local_syms + r_symndx;
          sym_sec = local_sections[r_symndx];
-         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
+         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
 
          /* If this symbol has an entry in the PA64 dynamic hash
             table, then get it.  */
-         dyn_name = get_dyn_name (input_section, h, rel,
+         dyn_name = get_dyn_name (input_bfd, h, rel,
                                   &dynh_buf, &dynh_buflen);
          dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
                                              dyn_name, FALSE, FALSE);
@@ -1444,7 +1399,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
 
              /* If this symbol has an entry in the PA64 dynamic hash
                 table, then get it.  */
-             dyn_name = get_dyn_name (input_section, h, rel,
+             dyn_name = get_dyn_name (input_bfd, h, rel,
                                       &dynh_buf, &dynh_buflen);
              dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
                                                  dyn_name, FALSE, FALSE);
@@ -1455,9 +1410,12 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
              if (sym_sec->output_section == NULL && dyn_h == NULL)
                {
                  (*_bfd_error_handler)
-                   (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
-                    bfd_archive_filename (input_bfd), h->root.root.string,
-                    bfd_get_section_name (input_bfd, input_section));
+                   (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+                    input_bfd,
+                    input_section,
+                    (long) rel->r_offset,
+                    howto->name,
+                    h->root.root.string);
                  relocation = 0;
                }
              else if (sym_sec->output_section)
@@ -1469,18 +1427,12 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
              else
                relocation = 0;
            }
-         /* Allow undefined symbols in shared libraries.  */
-         else if (info->shared && !info->no_undefined
+         else if (info->unresolved_syms_in_objects == RM_IGNORE
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            {
-             if (info->symbolic)
-               (*info->callbacks->undefined_symbol)
-                 (info, h->root.root.string, input_bfd,
-                  input_section, rel->r_offset, FALSE);
-
              /* If this symbol has an entry in the PA64 dynamic hash
                 table, then get it.  */
-             dyn_name = get_dyn_name (input_section, h, rel,
+             dyn_name = get_dyn_name (input_bfd, h, rel,
                                       &dynh_buf, &dynh_buflen);
              dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
                                                  dyn_name, FALSE, FALSE);
@@ -1488,15 +1440,26 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
              if (dyn_h == NULL)
                {
                  (*_bfd_error_handler)
-                   (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
-                    bfd_archive_filename (input_bfd), h->root.root.string,
-                    bfd_get_section_name (input_bfd, input_section));
-                 relocation = 0;
+                   (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
+                    input_bfd, input_section, h->root.root.string);
                }
              relocation = 0;
            }
          else if (h->root.type == bfd_link_hash_undefweak)
-           relocation = 0;
+            {
+             dyn_name = get_dyn_name (input_bfd, h, rel,
+                                      &dynh_buf, &dynh_buflen);
+             dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+                                                 dyn_name, FALSE, FALSE);
+
+             if (dyn_h == NULL)
+               {
+                 (*_bfd_error_handler)
+                   (_("%B(%A): warning: unresolvable relocation against symbol `%s'"),
+                    input_bfd, input_section, h->root.root.string);
+               }
+             relocation = 0;
+           }
          else
            {
              /* Ignore dynamic loader defined symbols.  */
@@ -1506,26 +1469,15 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
                {
                  if (!((*info->callbacks->undefined_symbol)
                        (info, h->root.root.string, input_bfd,
-                        input_section, rel->r_offset, TRUE)))
+                        input_section, rel->r_offset,
+                        (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+                         || ELF_ST_VISIBILITY (h->other)))))
                    return FALSE;
                  break;
                }
            }
        }
 
-      if (h != NULL)
-       sym_name = h->root.root.string;
-      else
-       {
-         sym_name = bfd_elf_string_from_elf_section (input_bfd,
-                                                     symtab_hdr->sh_link,
-                                                     sym->st_name);
-         if (sym_name == NULL)
-           return FALSE;
-         if (*sym_name == '\0')
-           sym_name = bfd_section_name (input_bfd, sym_sec);
-       }
-
       r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
                                        input_section, contents,
                                        relocation, info, sym_sec,
@@ -1539,9 +1491,25 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
              abort ();
            case bfd_reloc_overflow:
              {
+               const char *sym_name;
+               
+               if (h != NULL)
+                 sym_name = NULL;
+               else
+                 {
+                   sym_name = bfd_elf_string_from_elf_section (input_bfd,
+                                                               symtab_hdr->sh_link,
+                                                               sym->st_name);
+                   if (sym_name == NULL)
+                     return FALSE;
+                   if (*sym_name == '\0')
+                     sym_name = bfd_section_name (input_bfd, sym_sec);
+                 }
+
                if (!((*info->callbacks->reloc_overflow)
-                     (info, sym_name, howto->name, (bfd_vma) 0,
-                       input_bfd, input_section, rel->r_offset)))
+                     (info, (h ? &h->root : NULL), sym_name,
+                      howto->name, (bfd_vma) 0, input_bfd,
+                      input_section, rel->r_offset)))
                  return FALSE;
              }
              break;
@@ -1565,19 +1533,16 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
    function.  */
 
 static bfd_reloc_status_type
-elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
-                             input_section, contents, value,
-                             info, sym_sec, h, dyn_h)
-     Elf_Internal_Rela *rel;
-     bfd *input_bfd;
-     bfd *output_bfd;
-     asection *input_section;
-     bfd_byte *contents;
-     bfd_vma value;
-     struct bfd_link_info *info;
-     asection *sym_sec;
-     struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
-     struct elf64_hppa_dyn_hash_entry *dyn_h;
+elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
+                             bfd *input_bfd,
+                             bfd *output_bfd,
+                             asection *input_section,
+                             bfd_byte *contents,
+                             bfd_vma value,
+                             struct bfd_link_info *info,
+                             asection *sym_sec,
+                             struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
+                             struct elf64_hppa_dyn_hash_entry *dyn_h)
 {
   int insn;
   bfd_vma offset = rel->r_offset;
@@ -2123,10 +2088,7 @@ elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
    to insert the relocation into the given instruction.  */
 
 static int
-elf_hppa_relocate_insn (insn, sym_value, r_type)
-     int insn;
-     int sym_value;
-     unsigned int r_type;
+elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type)
 {
   switch (r_type)
     {
This page took 0.033158 seconds and 4 git commands to generate.