aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-02-19 23:36:55 +1030
committerAlan Modra <amodra@gmail.com>2018-02-19 23:55:55 +1030
commitf2b740ac53a3347b7e0fe1a09e52f6311265e709 (patch)
tree8f8cd6cbcd98022abe6c1a1d199963ce41d476cf /bfd
parent8979927ae719d1a16d2acd01a11cc17ed3c78dfb (diff)
downloadbinutils-f2b740ac53a3347b7e0fe1a09e52f6311265e709.zip
binutils-f2b740ac53a3347b7e0fe1a09e52f6311265e709.tar.gz
binutils-f2b740ac53a3347b7e0fe1a09e52f6311265e709.tar.bz2
Add attribute printf to _bfd_error_handler
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elf-attrs.c5
-rw-r--r--bfd/elfnn-riscv.c17
-rw-r--r--bfd/elfxx-mips.c7
-rw-r--r--bfd/libbfd-in.h2
-rw-r--r--bfd/libbfd.h2
6 files changed, 28 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8230981..0cfbef6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,15 @@
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.
(find_abstract_instance): Likewise.
* elfcore.h (elf_core_file_p): Likewise.
diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index 330c621..670012a 100644
--- a/bfd/elf-attrs.c
+++ b/bfd/elf-attrs.c
@@ -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;
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 5c8d4ab..2e54a4e 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -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;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 7253090..211f6f9 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -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;
}
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index b4477fc..e1eea28 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -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. */
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 5cc00d3..0fba5be 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -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. */