daily update
[deliverable/binutils-gdb.git] / bfd / elf-hppa.h
index 0f15b0de3325c92fb78eb8637eae82396f28b787..1e280b71efdfa679269cad69a19b6d7f68b9fd24 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
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -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,7 +40,6 @@ 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
 
@@ -812,6 +811,28 @@ elf_hppa_reloc_final_type (bfd *abfd,
            }
          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;
        }
@@ -1021,16 +1042,12 @@ static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
   if (s != NULL)
     {
       bfd_size_type size;
-      char *contents;
-
-      size = s->_raw_size;
-      contents = bfd_malloc (size);
-      if (contents == NULL)
-       return FALSE;
+      bfd_byte *contents;
 
-      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))
@@ -1048,7 +1065,7 @@ static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
 static bfd_boolean
 elf_hppa_add_symbol_hook (bfd *abfd,
                          struct bfd_link_info *info ATTRIBUTE_UNUSED,
-                         const Elf_Internal_Sym *sym,
+                         Elf_Internal_Sym *sym,
                          const char **namep ATTRIBUTE_UNUSED,
                          flagword *flagsp ATTRIBUTE_UNUSED,
                          asection **secp,
@@ -1096,8 +1113,7 @@ elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
      Ultimately we should have better controls over the generic ELF BFD
      linker code.  */
   if (! info->relocatable
-      && ! (info->shared
-           && info->unresolved_syms_in_shared_libs == RM_IGNORE)
+      && 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)
@@ -1123,7 +1139,7 @@ elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
      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.
@@ -1131,8 +1147,7 @@ elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
      Ultimately we should have better controls over the generic ELF BFD
      linker code.  */
   if (! info->relocatable
-      && ! (info->shared
-           && info->unresolved_syms_in_shared_libs == RM_IGNORE)
+      && 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
@@ -1261,7 +1276,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *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
@@ -1274,7 +1289,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *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,
@@ -1350,7 +1365,7 @@ elf_hppa_relocate_section (bfd *output_bfd,
 
          /* 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);
@@ -1373,7 +1388,7 @@ elf_hppa_relocate_section (bfd *output_bfd,
 
              /* 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);
@@ -1398,19 +1413,12 @@ elf_hppa_relocate_section (bfd *output_bfd,
              else
                relocation = 0;
            }
-         /* Allow undefined symbols in shared libraries.  */
-         else if (info->shared
-                  && info->unresolved_syms_in_shared_libs == RM_IGNORE
+         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);
@@ -1426,7 +1434,7 @@ elf_hppa_relocate_section (bfd *output_bfd,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
             {
-             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);
@@ -1449,7 +1457,9 @@ elf_hppa_relocate_section (bfd *output_bfd,
                {
                  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;
                }
This page took 0.025787 seconds and 4 git commands to generate.