Add attribute printf to _bfd_error_handler
authorAlan Modra <amodra@gmail.com>
Mon, 19 Feb 2018 13:06:55 +0000 (23:36 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 19 Feb 2018 13:25:55 +0000 (23:55 +1030)
and fix a few stray errors.

* elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
arguments.
* elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
* elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_pc): Likewise and fix typos.
* libbfd-in.h (_bfd_error_handler): Add attribute printf.
* libbfd.h: Regenerate.

bfd/ChangeLog
bfd/elf-attrs.c
bfd/elfnn-riscv.c
bfd/elfxx-mips.c
bfd/libbfd-in.h
bfd/libbfd.h

index 82309816e36652f0aefb050fab0a573fbabbde2e..0cfbef6a59a9cc01dc4451a884032d008fd1f46a 100644 (file)
@@ -1,3 +1,13 @@
+2018-02-19  Alan Modra  <amodra@gmail.com>
+
+       * elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
+       arguments.
+       * elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
+       * elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
+       (_bfd_riscv_relax_pc): Likewise and fix typos.
+       * libbfd-in.h (_bfd_error_handler): Add attribute printf.
+       * libbfd.h: Regenerate.
+
 2018-02-19  Alan Modra  <amodra@gmail.com>
 
        * dwarf2.c (read_section): Don't use 'll' format modifier.
index 330c621dbf534d82cbb0a55c1fac3437b98bb9c6..670012a9f293ff0f8133ef1b3b90e255021fe722 100644 (file)
@@ -472,8 +472,9 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
          len -= section_len;
          if (section_len <= 4)
            {
-             _bfd_error_handler (_("%pB: error: attribute section length too small: %ld"),
-                                 abfd, section_len);
+             _bfd_error_handler
+               (_("%pB: error: attribute section length too small: %" PRId64),
+                abfd, (int64_t) section_len);
              break;
            }
          section_len -= 4;
index 5c8d4ab12dedac1bff582c03aad0def394067e52..2e54a4e0718feff2b18f585fa93356f7e085c41c 100644 (file)
@@ -3111,10 +3111,11 @@ _bfd_riscv_relax_align (bfd *abfd, asection *sec,
   /* Make sure there are enough NOPs to actually achieve the alignment.  */
   if (rel->r_addend < nop_bytes)
     {
-      (*_bfd_error_handler)
-       (_("%pB(%pA+0x%lx): %d bytes required for alignment "
-          "to %d-byte boundary, but only %d present"),
-          abfd, sym_sec, rel->r_offset, nop_bytes, alignment, rel->r_addend);
+      _bfd_error_handler
+       (_("%pB(%pA+%#" PRIx64 "): %" PRId64 " bytes required for alignment "
+          "to %" PRId64 "-byte boundary, but only %" PRId64 " present"),
+        abfd, sym_sec, (uint64_t) rel->r_offset,
+        (int64_t) nop_bytes, (int64_t) alignment, (int64_t) rel->r_addend);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -3178,10 +3179,10 @@ _bfd_riscv_relax_pc  (bfd *abfd,
        symval = hi_reloc.hi_addr;
        sym_sec = hi_reloc.sym_sec;
        if (!riscv_use_pcgp_hi_reloc(pcgp_relocs, hi->hi_sec_off))
-         (*_bfd_error_handler)
-          (_("%pB(%pA+0x%lx): Unable to clear RISCV_PCREL_HI20 reloc"
-             "for cooresponding RISCV_PCREL_LO12 reloc"),
-           abfd, sec, rel->r_offset);
+         _bfd_error_handler
+           (_("%pB(%pA+%#" PRIx64 "): Unable to clear RISCV_PCREL_HI20 reloc "
+              "for corresponding RISCV_PCREL_LO12 reloc"),
+            abfd, sec, (uint64_t) rel->r_offset);
       }
       break;
 
index 72530903a8c476c632b9dcee646a6a095329146d..211f6f9c7e81243885c638b7d470e65de2ba3c99 100644 (file)
@@ -14404,9 +14404,10 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
          if (o->size != sizeof (Elf32_External_RegInfo))
            {
              _bfd_error_handler
-               (_("%pB: .reginfo section size should be %d bytes, "
-                  "actual size is %d"),
-                abfd, sizeof (Elf32_External_RegInfo), o->size);
+               (_("%pB: .reginfo section size should be %ld bytes, "
+                  "actual size is %" PRId64),
+                abfd, (unsigned long) sizeof (Elf32_External_RegInfo),
+                (int64_t) o->size);
 
              return FALSE;
            }
index b4477fc7dc92c2c784b092b89cfa1ab5227a5617..e1eea282ed5a83449f07eb6ae2884d2b62817e41 100644 (file)
@@ -109,7 +109,7 @@ extern void *bfd_realloc2
 extern void *bfd_zmalloc2
   (bfd_size_type, bfd_size_type);
 
-extern void _bfd_error_handler (const char *s, ...);
+extern void _bfd_error_handler (const char *s, ...) ATTRIBUTE_PRINTF_1;
 
 /* These routines allocate and free things on the BFD's objalloc.  */
 
index 5cc00d387bc999382d39b972f529a891eb7c9459..0fba5bea3e994f342c0e70ceed8537cef716d3ac 100644 (file)
@@ -114,7 +114,7 @@ extern void *bfd_realloc2
 extern void *bfd_zmalloc2
   (bfd_size_type, bfd_size_type);
 
-extern void _bfd_error_handler (const char *s, ...);
+extern void _bfd_error_handler (const char *s, ...) ATTRIBUTE_PRINTF_1;
 
 /* These routines allocate and free things on the BFD's objalloc.  */
 
This page took 0.035152 seconds and 4 git commands to generate.