IA16 support
[deliverable/binutils-gdb.git] / bfd / elf32-hppa.c
index cbe42cfde9f0e7d82b3337b40e0a552a11a42eb6..1deebf4f038ee595757be714e2429331620300a2 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for HP PA-RISC ELF files.
-   Copyright (C) 1990-2016 Free Software Foundation, Inc.
+   Copyright (C) 1990-2017 Free Software Foundation, Inc.
 
    Original code by
        Center for Software Science
@@ -1056,19 +1056,20 @@ elf32_hppa_copy_indirect_symbol (struct bfd_link_info *info,
       /* If called to transfer flags for a weakdef during processing
         of elf_adjust_dynamic_symbol, don't copy non_got_ref.
         We clear it ourselves for ELIMINATE_COPY_RELOCS.  */
-      eh_dir->ref_dynamic |= eh_ind->ref_dynamic;
+      if (eh_dir->versioned != versioned_hidden)
+       eh_dir->ref_dynamic |= eh_ind->ref_dynamic;
       eh_dir->ref_regular |= eh_ind->ref_regular;
       eh_dir->ref_regular_nonweak |= eh_ind->ref_regular_nonweak;
       eh_dir->needs_plt |= eh_ind->needs_plt;
     }
   else
     {
-      if (eh_ind->root.type == bfd_link_hash_indirect
-          && eh_dir->got.refcount <= 0)
-        {
-          hh_dir->tls_type = hh_ind->tls_type;
-          hh_ind->tls_type = GOT_UNKNOWN;
-        }
+      if (eh_ind->root.type == bfd_link_hash_indirect)
+       {
+         hh_dir->plabel |= hh_ind->plabel;
+         hh_dir->tls_type |= hh_ind->tls_type;
+         hh_ind->tls_type = GOT_UNKNOWN;
+       }
 
       _bfd_elf_link_hash_copy_indirect (info, eh_dir, eh_ind);
     }
@@ -1918,6 +1919,21 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
   return _bfd_elf_adjust_dynamic_copy (info, eh, sec);
 }
 
+/* Make an undefined weak symbol dynamic.  */
+
+static bfd_boolean
+ensure_undef_weak_dynamic (struct bfd_link_info *info,
+                          struct elf_link_hash_entry *eh)
+{
+  if (eh->dynindx == -1
+      && !eh->forced_local
+      && eh->type != STT_PARISC_MILLI
+      && eh->root.type == bfd_link_hash_undefweak
+      && ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT)
+    return bfd_elf_link_record_dynamic_symbol (info, eh);
+  return TRUE;
+}
+
 /* Allocate space in the .plt for entries that won't have relocations.
    ie. plabel entries.  */
 
@@ -1941,15 +1957,8 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
   if (htab->etab.dynamic_sections_created
       && eh->plt.refcount > 0)
     {
-      /* Make sure this symbol is output as a dynamic symbol.
-        Undefined weak syms won't yet be marked as dynamic.  */
-      if (eh->dynindx == -1
-         && !eh->forced_local
-         && eh->type != STT_PARISC_MILLI)
-       {
-         if (! bfd_elf_link_record_dynamic_symbol (info, eh))
-           return FALSE;
-       }
+      if (!ensure_undef_weak_dynamic (info, eh))
+       return FALSE;
 
       if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), eh))
        {
@@ -1967,6 +1976,8 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
          sec = htab->etab.splt;
          eh->plt.offset = sec->size;
          sec->size += PLT_ENTRY_SIZE;
+         if (bfd_link_pic (info))
+           htab->etab.srelplt->size += sizeof (Elf32_External_Rela);
        }
       else
        {
@@ -2023,15 +2034,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
 
   if (eh->got.refcount > 0)
     {
-      /* Make sure this symbol is output as a dynamic symbol.
-        Undefined weak syms won't yet be marked as dynamic.  */
-      if (eh->dynindx == -1
-         && !eh->forced_local
-         && eh->type != STT_PARISC_MILLI)
-       {
-         if (! bfd_elf_link_record_dynamic_symbol (info, eh))
-           return FALSE;
-       }
+      if (!ensure_undef_weak_dynamic (info, eh))
+       return FALSE;
 
       sec = htab->etab.sgot;
       eh->got.offset = sec->size;
@@ -2091,14 +2095,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
          if (ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT)
            hh->dyn_relocs = NULL;
 
-         /* Make sure undefined weak symbols are output as a dynamic
-            symbol in PIEs.  */
-         else if (eh->dynindx == -1
-                  && !eh->forced_local)
-           {
-             if (! bfd_elf_link_record_dynamic_symbol (info, eh))
-               return FALSE;
-           }
+         else if (!ensure_undef_weak_dynamic (info, eh))
+           return FALSE;
        }
     }
   else
@@ -2115,15 +2113,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
                   && (eh->root.type == bfd_link_hash_undefweak
                       || eh->root.type == bfd_link_hash_undefined))))
        {
-         /* Make sure this symbol is output as a dynamic symbol.
-            Undefined weak syms won't yet be marked as dynamic.  */
-         if (eh->dynindx == -1
-             && !eh->forced_local
-             && eh->type != STT_PARISC_MILLI)
-           {
-             if (! bfd_elf_link_record_dynamic_symbol (info, eh))
-               return FALSE;
-           }
+         if (!ensure_undef_weak_dynamic (info, eh))
+           return FALSE;
 
          /* If that succeeded, we know we'll be keeping all the
             relocs.  */
@@ -4441,7 +4432,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
                      + eh->root.u.def.section->output_section->vma);
       rela.r_addend = 0;
       rela.r_info = ELF32_R_INFO (eh->dynindx, R_PARISC_COPY);
-      if ((eh->root.u.def.section->flags & SEC_READONLY) != 0)
+      if (eh->root.u.def.section == htab->etab.sdynrelro)
        sec = htab->etab.sreldynrelro;
       else
        sec = htab->etab.srelbss;
@@ -4655,6 +4646,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
 #define elf_backend_want_dynrelro           1
 #define elf_backend_rela_normal                     1
 #define elf_backend_dtrel_excludes_plt      1
+#define elf_backend_no_page_alias           1
 
 #define TARGET_BIG_SYM         hppa_elf32_vec
 #define TARGET_BIG_NAME                "elf32-hppa"
This page took 0.031326 seconds and 4 git commands to generate.