bfd/
[deliverable/binutils-gdb.git] / bfd / elf64-sparc.c
index 75704e2e56a56b45f37e4c0e6c98e5561ee64e4a..01b80cda4d5a6d043e5811fc7be2aa25c91a5557 100644 (file)
@@ -1265,7 +1265,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
                return FALSE;
            }
 
-         h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+         h->needs_plt = 1;
          if (ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT32
              && ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT64)
            break;
@@ -1368,9 +1368,8 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
          break;
 
        default:
-         (*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"),
-                               bfd_archive_filename (abfd),
-                               ELF64_R_TYPE_ID (rel->r_info));
+         (*_bfd_error_handler) (_("%B: check_relocs: unhandled reloc type %d"),
+                               abfd, ELF64_R_TYPE_ID (rel->r_info));
          return FALSE;
        }
     }
@@ -1405,8 +1404,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
        case 6: reg -= 4; break;
        default:
           (*_bfd_error_handler)
-            (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"),
-             bfd_archive_filename (abfd));
+            (_("%B: Only registers %%g[2367] can be declared using STT_REGISTER"),
+             abfd);
          return FALSE;
        }
 
@@ -1425,10 +1424,10 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
       if (p->name != NULL && strcmp (p->name, *namep))
        {
           (*_bfd_error_handler)
-            (_("Register %%g%d used incompatibly: %s in %s, previously %s in %s"),
-             (int) sym->st_value,
-             **namep ? *namep : "#scratch", bfd_archive_filename (abfd),
-             *p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd));
+            (_("Register %%g%d used incompatibly: %s in %B, previously %s in %B"),
+             abfd, p->abfd, (int) sym->st_value,
+             **namep ? *namep : "#scratch",
+             *p->name ? p->name : "#scratch");
          return FALSE;
        }
 
@@ -1448,9 +1447,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
                  if (type > STT_FUNC)
                    type = 0;
                  (*_bfd_error_handler)
-                   (_("Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"),
-                    *namep, bfd_archive_filename (abfd),
-                    stt_types[type], bfd_archive_filename (p->abfd));
+                   (_("Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"),
+                    abfd, p->abfd, *namep, stt_types[type]);
                  return FALSE;
                }
 
@@ -1494,9 +1492,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
            if (type > STT_FUNC)
              type = 0;
            (*_bfd_error_handler)
-             (_("Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"),
-              *namep, stt_types[type], bfd_archive_filename (abfd),
-              bfd_archive_filename (p->abfd));
+             (_("Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"),
+              abfd, p->abfd, *namep, stt_types[type]);
            return FALSE;
          }
     }
@@ -1615,14 +1612,11 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
 
   /* Make sure we know what is going on here.  */
   BFD_ASSERT (dynobj != NULL
-             && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
-                 || h->weakdef != NULL
-                 || ((h->elf_link_hash_flags
-                      & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-                     && (h->elf_link_hash_flags
-                         & ELF_LINK_HASH_REF_REGULAR) != 0
-                     && (h->elf_link_hash_flags
-                         & ELF_LINK_HASH_DEF_REGULAR) == 0)));
+             && (h->needs_plt
+                 || h->u.weakdef != NULL
+                 || (h->def_dynamic
+                     && h->ref_regular
+                     && !h->def_regular)));
 
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later
@@ -1632,7 +1626,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
      some of their functions as STT_NOTYPE when they really should be
      STT_FUNC.  */
   if (h->type == STT_FUNC
-      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
+      || h->needs_plt
       || (h->type == STT_NOTYPE
          && (h->root.type == bfd_link_hash_defined
              || h->root.type == bfd_link_hash_defweak)
@@ -1645,7 +1639,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
              In such a case, we don't actually need to build a
              procedure linkage table, and we can just do a WDISP30
              reloc instead.  */
-         BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+         BFD_ASSERT (h->needs_plt);
          return TRUE;
        }
 
@@ -1665,7 +1659,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
         pointers compare as equal between the normal executable and
         the shared library.  */
       if (! info->shared
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+         && !h->def_regular)
        {
          h->root.u.def.section = s;
          h->root.u.def.value = sparc64_elf_plt_entry_offset (h->plt.offset);
@@ -1695,12 +1689,12 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
      real definition first, and we can just use the same value.  */
-  if (h->weakdef != NULL)
+  if (h->u.weakdef != NULL)
     {
-      BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
-                 || h->weakdef->root.type == bfd_link_hash_defweak);
-      h->root.u.def.section = h->weakdef->root.u.def.section;
-      h->root.u.def.value = h->weakdef->root.u.def.value;
+      BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
+                 || h->u.weakdef->root.type == bfd_link_hash_defweak);
+      h->root.u.def.section = h->u.weakdef->root.u.def.section;
+      h->root.u.def.value = h->u.weakdef->root.u.def.value;
       return TRUE;
     }
 
@@ -1738,7 +1732,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h)
       srel = bfd_get_section_by_name (dynobj, ".rela.bss");
       BFD_ASSERT (srel != NULL);
       srel->size += sizeof (Elf64_External_Rela);
-      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+      h->needs_copy = 1;
     }
 
   /* We need to figure out the alignment required for this symbol.  I
@@ -2225,8 +2219,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                   become local.  */
                else if (h != NULL && ! is_plt
                         && ((! info->symbolic && h->dynindx != -1)
-                            || (h->elf_link_hash_flags
-                                & ELF_LINK_HASH_DEF_REGULAR) == 0))
+                            || !h->def_regular))
                  {
                    BFD_ASSERT (h->dynindx != -1);
                    outrel.r_info
@@ -2275,8 +2268,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                              {
                                BFD_FAIL ();
                                (*_bfd_error_handler)
-                                 (_("%s: probably compiled without -fPIC?"),
-                                  bfd_archive_filename (input_bfd));
+                                 (_("%B: probably compiled without -fPIC?"),
+                                  input_bfd);
                                bfd_set_error (bfd_error_bad_value);
                                return FALSE;
                              }
@@ -2328,8 +2321,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  || (info->shared
                      && (info->symbolic
                          || h->dynindx == -1
-                         || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-                     && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+                         || h->forced_local)
+                     && h->def_regular))
                {
                  /* This is actually a static link, or it is a -Bsymbolic
                     link and the symbol is defined locally, or the symbol
@@ -2617,11 +2610,10 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
         not process them.  */
       if (unresolved_reloc
          && !((input_section->flags & SEC_DEBUGGING) != 0
-              && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+              && h->def_dynamic))
        (*_bfd_error_handler)
-         (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
-          bfd_archive_filename (input_bfd),
-          bfd_get_section_name (input_bfd, input_section),
+         (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
+          input_bfd, input_section,
           (long) rel->r_offset,
           h->root.root.string);
 
@@ -2660,7 +2652,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                    break;
                  }
 
-               name = h->root.root.string;
+               name = NULL;
              }
            else
              {
@@ -2674,8 +2666,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  name = bfd_section_name (input_bfd, sec);
              }
            if (! ((*info->callbacks->reloc_overflow)
-                  (info, name, howto->name, (bfd_vma) 0,
-                   input_bfd, input_section, rel->r_offset)))
+                  (info, (h ? &h->root : NULL), name, howto->name,
+                   (bfd_vma) 0, input_bfd, input_section,
+                   rel->r_offset)))
              return FALSE;
          }
        break;
@@ -2740,7 +2733,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
       loc += (h->plt.offset - 4) * sizeof (Elf64_External_Rela);
       bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
 
-      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+      if (!h->def_regular)
        {
          /* Mark the symbol as undefined, rather than as defined in
             the .plt section.  Leave the value alone.  */
@@ -2749,8 +2742,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
             Otherwise, the PLT entry would provide a definition for
             the symbol even if the symbol wasn't defined anywhere,
             and so the symbol would never be NULL.  */
-         if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
-             == 0)
+         if (!h->ref_regular_nonweak)
            sym->st_value = 0;
        }
     }
@@ -2779,7 +2771,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
         initialized in the relocate_section function.  */
       if (info->shared
          && (info->symbolic || h->dynindx == -1)
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+         && h->def_regular)
        {
          asection *sec = h->root.u.def.section;
          rela.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
@@ -2800,7 +2792,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
     }
 
-  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+  if (h->needs_copy)
     {
       asection *s;
       Elf_Internal_Rela rela;
@@ -3003,8 +2995,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
            {
              error = TRUE;
              (*_bfd_error_handler)
-               (_("%s: linking UltraSPARC specific with HAL specific code"),
-                bfd_archive_filename (ibfd));
+               (_("%B: linking UltraSPARC specific with HAL specific code"),
+                ibfd);
            }
          /* Choose the most restrictive memory ordering.  */
          old_mm = (old_flags & EF_SPARCV9_MM);
@@ -3022,8 +3014,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
         {
           error = TRUE;
           (*_bfd_error_handler)
-            (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
-             bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
+            (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
+             ibfd, (long) new_flags, (long) old_flags);
         }
 
       elf_elfheader (obfd)->e_flags = old_flags;
This page took 0.028204 seconds and 4 git commands to generate.