bfd_section_* macros
[deliverable/binutils-gdb.git] / bfd / elf32-metag.c
index 9de08b32962942eacd7be1c364cfd85e30aea2b0..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 (_("%pB: 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 *
@@ -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
        {
@@ -1913,8 +1916,10 @@ elf_metag_relocate_section (bfd *output_bfd,
            {
              _bfd_error_handler
                /* xgettext:c-format */
-               (_("%pB(%pA+%#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
@@ -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
-       (_("%pB: dynamic relocation against `%T' in read-only section `%pA'\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;
This page took 0.027939 seconds and 4 git commands to generate.