Use %A and %B in more error messages
[deliverable/binutils-gdb.git] / bfd / elf32-sh64.c
index 227cd5fb45af53dcbc235378a9234d5b5a69c533..de7ce95d0349d8941453ef9bead2483b175a542f 100644 (file)
@@ -1,5 +1,5 @@
 /* SuperH SH64-specific support for 32-bit ELF
-   Copyright (C) 2000-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2017 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -44,7 +44,7 @@ static bfd_boolean sh64_elf_new_section_hook
 static bfd_boolean sh64_elf_copy_private_data
   (bfd *, bfd *);
 static bfd_boolean sh64_elf_merge_private_data
-  (bfd *, bfd *);
+  (bfd *, struct bfd_link_info *);
 static bfd_boolean sh64_elf_fake_sections
   (bfd *, Elf_Internal_Shdr *, asection *);
 static bfd_boolean sh64_elf_set_private_flags
@@ -203,11 +203,12 @@ sh64_elf_copy_private_data (bfd * ibfd, bfd * obfd)
 }
 
 static bfd_boolean
-sh64_elf_merge_private_data (bfd *ibfd, bfd *obfd)
+sh64_elf_merge_private_data (bfd *ibfd, struct bfd_link_info *info)
 {
+  bfd *obfd = info->output_bfd;
   flagword old_flags, new_flags;
 
-  if (! _bfd_generic_verify_endian_match (ibfd, obfd))
+  if (! _bfd_generic_verify_endian_match (ibfd, info))
     return FALSE;
 
   if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
@@ -220,15 +221,17 @@ sh64_elf_merge_private_data (bfd *ibfd, bfd *obfd)
 
       if (bfd_get_arch_size (ibfd) == 32
          && bfd_get_arch_size (obfd) == 64)
-       msg = _("%s: compiled as 32-bit object and %s is 64-bit");
+       /* xgettext:c-format */
+       msg = _("%B: compiled as 32-bit object and %B is 64-bit");
       else if (bfd_get_arch_size (ibfd) == 64
               && bfd_get_arch_size (obfd) == 32)
-       msg = _("%s: compiled as 64-bit object and %s is 32-bit");
+       /* xgettext:c-format */
+       msg = _("%B: compiled as 64-bit object and %B is 32-bit");
       else
-       msg = _("%s: object size does not match that of target %s");
+       /* xgettext:c-format */
+       msg = _("%B: object size does not match that of target %B");
 
-      (*_bfd_error_handler) (msg, bfd_get_filename (ibfd),
-                            bfd_get_filename (obfd));
+      _bfd_error_handler (msg, ibfd, obfd);
       bfd_set_error (bfd_error_wrong_format);
       return FALSE;
     }
@@ -244,9 +247,10 @@ sh64_elf_merge_private_data (bfd *ibfd, bfd *obfd)
   /* We don't allow linking in non-SH64 code.  */
   else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5)
     {
-      (*_bfd_error_handler)
-       ("%s: uses non-SH64 instructions while previous modules use SH64 instructions",
-        bfd_get_filename (ibfd));
+      _bfd_error_handler
+       ("%B: uses non-SH64 instructions while previous modules"
+        " use SH64 instructions",
+        ibfd);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -397,7 +401,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
         right, and tweak the name when it's output.  Otherwise, we make
         an indirect symbol of it.  */
       flagword flags
-       = info->relocatable || info->emitrelocations
+       = bfd_link_relocatable (info) || info->emitrelocations
        ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT;
 
       char *dl_name
@@ -441,15 +445,14 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
        free (dl_name);
 
       if (h->type != STT_DATALABEL
-         || ((info->relocatable || info->emitrelocations)
+         || ((bfd_link_relocatable (info) || info->emitrelocations)
              && h->root.type != bfd_link_hash_undefined)
-         || (! info->relocatable && !info->emitrelocations
+         || (! bfd_link_relocatable (info) && !info->emitrelocations
              && h->root.type != bfd_link_hash_indirect))
        {
          /* Make sure we don't get confused on invalid input.  */
-         (*_bfd_error_handler)
-           (_("%s: encountered datalabel symbol in input"),
-            bfd_get_filename (abfd));
+         _bfd_error_handler
+           (_("%B: encountered datalabel symbol in input"), abfd);
          bfd_set_error (bfd_error_bad_value);
          return FALSE;
        }
@@ -487,7 +490,7 @@ sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
 {
   char *name = (char *) cname;
 
-  if (info->relocatable || info->emitrelocations)
+  if (bfd_link_relocatable (info) || info->emitrelocations)
     {
       if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
        name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
@@ -530,11 +533,9 @@ shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd,
                     && ((*relocation + rel->r_addend) & 1) == 0)
              msg = _("PTA mismatch: a SHcompact address (bit 0 == 0)");
 
-           if (msg != NULL
-               && ! ((*info->callbacks->reloc_dangerous)
-                     (info, msg, abfd, input_section,
-                      rel->r_offset)))
-             return FALSE;
+           if (msg != NULL)
+             (*info->callbacks->reloc_dangerous)
+               (info, msg, abfd, input_section, rel->r_offset);
          }
        else
          {
@@ -545,9 +546,9 @@ shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd,
               unknown destination (or when relaxing) will get us here.  */
            if ((insn & SHMEDIA_PTB_BIT) != 0)
              {
-               (*_bfd_error_handler)
-                 (_("%s: GAS error: unexpected PTB insn with R_SH_PT_16"),
-                  bfd_get_filename (input_section->owner));
+               _bfd_error_handler
+                 (_("%B: GAS error: unexpected PTB insn with R_SH_PT_16"),
+                  input_section->owner);
                return FALSE;
              }
 
@@ -594,7 +595,8 @@ shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd,
     }
   if (dropped != 0)
     {
-      (*_bfd_error_handler)
+      _bfd_error_handler
+       /* xgettext:c-format */
        (_("%B: error: unaligned relocation type %d at %08x reloc %p\n"),
         input_section->owner, ELF32_R_TYPE (rel->r_info),
         (unsigned) rel->r_offset, relocation);
@@ -670,9 +672,8 @@ sh64_elf_final_write_processing (bfd *abfd,
                                      ld_generated_cranges_size))
        {
          bfd_set_error (bfd_error_file_truncated);
-         (*_bfd_error_handler)
-           (_("%s: could not write out added .cranges entries"),
-            bfd_get_filename (abfd));
+         _bfd_error_handler
+           (_("%B: could not write out added .cranges entries"), abfd);
        }
     }
 
@@ -730,9 +731,8 @@ sh64_elf_final_write_processing (bfd *abfd,
                                          cranges_size))
            {
              bfd_set_error (bfd_error_file_truncated);
-             (*_bfd_error_handler)
-               (_("%s: could not write out sorted .cranges entries"),
-                bfd_get_filename (abfd));
+             _bfd_error_handler
+               (_("%B: could not write out sorted .cranges entries"), abfd);
            }
        }
     }
@@ -766,11 +766,11 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
 };
 
 #undef TARGET_BIG_SYM
-#define        TARGET_BIG_SYM          bfd_elf32_sh64_vec
+#define        TARGET_BIG_SYM          sh64_elf32_vec
 #undef TARGET_BIG_NAME
 #define        TARGET_BIG_NAME         "elf32-sh64"
 #undef TARGET_LITTLE_SYM
-#define        TARGET_LITTLE_SYM       bfd_elf32_sh64l_vec
+#define        TARGET_LITTLE_SYM       sh64_elf32_le_vec
 #undef TARGET_LITTLE_NAME
 #define        TARGET_LITTLE_NAME      "elf32-sh64l"
 
@@ -778,11 +778,11 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
 
 /* NetBSD support.  */
 #undef TARGET_BIG_SYM
-#define        TARGET_BIG_SYM          bfd_elf32_sh64nbsd_vec
+#define        TARGET_BIG_SYM          sh64_elf32_nbsd_vec
 #undef TARGET_BIG_NAME
 #define        TARGET_BIG_NAME         "elf32-sh64-nbsd"
 #undef TARGET_LITTLE_SYM
-#define        TARGET_LITTLE_SYM       bfd_elf32_sh64lnbsd_vec
+#define        TARGET_LITTLE_SYM       sh64_elf32_nbsd_le_vec
 #undef TARGET_LITTLE_NAME
 #define        TARGET_LITTLE_NAME      "elf32-sh64l-nbsd"
 #undef ELF_MAXPAGESIZE
@@ -797,11 +797,11 @@ static const struct bfd_elf_special_section sh64_elf_special_sections[] =
 
 /* Linux support.  */
 #undef TARGET_BIG_SYM
-#define        TARGET_BIG_SYM          bfd_elf32_sh64blin_vec
+#define        TARGET_BIG_SYM          sh64_elf32_linux_be_vec
 #undef TARGET_BIG_NAME
 #define        TARGET_BIG_NAME         "elf32-sh64big-linux"
 #undef TARGET_LITTLE_SYM
-#define        TARGET_LITTLE_SYM       bfd_elf32_sh64lin_vec
+#define        TARGET_LITTLE_SYM       sh64_elf32_linux_vec
 #undef TARGET_LITTLE_NAME
 #define        TARGET_LITTLE_NAME      "elf32-sh64-linux"
 #undef elf32_bed
This page took 0.026515 seconds and 4 git commands to generate.