bfd_section_* macros
[deliverable/binutils-gdb.git] / bfd / elf32-metag.c
index d7b7059e0369fc8565561e4d0d735de21af017df..e3df8c56843bf83d4e65b78cd25fd93c39651b70 100644 (file)
@@ -1,5 +1,5 @@
 /* Meta support for 32-bit ELF
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
+   Copyright (C) 2013-2019 Free Software Foundation, Inc.
    Contributed by Imagination Technologies Ltd.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -864,8 +864,8 @@ tpoff (struct bfd_link_info *info, bfd_vma address)
                         elf_hash_table (info)->tls_sec->alignment_power));
 }
 
-static void
-metag_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
+static bfd_boolean
+metag_info_to_howto_rela (bfd *abfd,
                          arelent *cache_ptr,
                          Elf_Internal_Rela *dst)
 {
@@ -875,10 +875,13 @@ metag_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
   if (r_type >= (unsigned int) R_METAG_MAX)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%B: invalid METAG reloc number: %d"), abfd, r_type);
-      r_type = 0;
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+                         abfd, r_type);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
     }
   cache_ptr->howto = & elf_metag_howto_table [r_type];
+  return TRUE;
 }
 
 static reloc_howto_type *
@@ -1180,7 +1183,7 @@ metag_add_stub (const char *stub_name,
   if (hsh == NULL)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%B: cannot create stub entry %s"),
+      _bfd_error_handler (_("%pB: cannot create stub entry %s"),
                          section->owner, stub_name);
       return NULL;
     }
@@ -1393,7 +1396,7 @@ metag_final_link_relocate (reloc_howto_type *howto,
                                              rel, relend, howto, contents) \
   {                                                                    \
     _bfd_clear_contents (howto, input_bfd, input_section,              \
-                        contents + rel->r_offset);                     \
+                        contents, rel->r_offset);                      \
                                                                        \
     if (bfd_link_relocatable (info)                                    \
        && (input_section->flags & SEC_DEBUGGING))                      \
@@ -1516,7 +1519,7 @@ elf_metag_relocate_section (bfd *output_bfd,
 
          name = bfd_elf_string_from_elf_section
            (input_bfd, symtab_hdr->sh_link, sym->st_name);
-         name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+         name = name == NULL ? bfd_section_name (sec) : name;
        }
       else
        {
@@ -1857,10 +1860,10 @@ elf_metag_relocate_section (bfd *output_bfd,
                        /* We don't support changing the TLS model.  */
                        /* PR 20675 */
                        if (bfd_link_pic (info))
-                         _bfd_error_handler (_("%B(%A): multiple TLS models are not supported"),
+                         _bfd_error_handler (_("%pB(%pA): multiple TLS models are not supported"),
                                              input_bfd, input_section);
                        else
-                         _bfd_error_handler (_("%B(%A): shared library symbol %s encountered whilst performing a static link"),
+                         _bfd_error_handler (_("%pB(%pA): shared library symbol %s encountered whilst performing a static link"),
                                              input_bfd, input_section, name);
                        return FALSE;
                      }
@@ -1913,8 +1916,10 @@ elf_metag_relocate_section (bfd *output_bfd,
            {
              _bfd_error_handler
                /* xgettext:c-format */
-               (_("%B(%A+%#Lx): %s relocation not permitted in shared object"),
-                input_bfd, input_section, rel->r_offset, howto->name);
+               (_("%pB(%pA+%#" PRIx64 "): "
+                  "%s relocation not permitted in shared object"),
+                input_bfd, input_section, (uint64_t) rel->r_offset,
+                howto->name);
              return FALSE;
            }
          else
@@ -2249,7 +2254,7 @@ elf_metag_check_relocs (bfd *abfd,
                name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
              _bfd_error_handler
                /* xgettext:c-format */
-               (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
+               (_("%pB: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
                 abfd, elf_metag_howto_table[r_type].name, name);
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
@@ -2369,9 +2374,7 @@ elf_metag_check_relocs (bfd *abfd,
          /* This relocation describes which C++ vtable entries are actually
             used.  Record for later use during GC.  */
        case R_METAG_GNU_VTENTRY:
-         BFD_ASSERT (hh != NULL);
-         if (hh != NULL
-             && !bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend))
+         if (!bfd_elf_gc_record_vtentry (abfd, sec, &hh->eh, rel->r_addend))
            return FALSE;
          break;
        }
@@ -2789,7 +2792,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p)
 
       info->flags |= DF_TEXTREL;
       info->callbacks->minfo
-       (_("%B: dynamic relocation against `%T' in read-only section `%A'\n"),
+       (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
         sec->owner, h->root.root.string, sec);
 
       /* Not an error, just cut short the traversal.  */
@@ -2931,7 +2934,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* Strip this section if we don't need it; see the
             comment below.  */
        }
-      else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
+      else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
        {
          if (s->size != 0 && s != htab->etab.srelplt)
            relocs = TRUE;
@@ -4141,7 +4144,7 @@ elf_metag_plt_sym_val (bfd_vma i, const asection *plt,
 #define elf_backend_finish_dynamic_sections    elf_metag_finish_dynamic_sections
 #define elf_backend_size_dynamic_sections      elf_metag_size_dynamic_sections
 #define elf_backend_omit_section_dynsym \
-  ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) (bfd_boolean (*)) bfd_true)
+       _bfd_elf_omit_section_dynsym_all
 #define elf_backend_post_process_headers       elf_metag_post_process_headers
 #define elf_backend_reloc_type_class           elf_metag_reloc_type_class
 #define elf_backend_copy_indirect_symbol       elf_metag_copy_indirect_symbol
This page took 0.029372 seconds and 4 git commands to generate.