summaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-07-03 21:59:45 +0930
committerAlan Modra <amodra@gmail.com>2017-07-03 22:03:49 +0930
commit76cfced5addbd827652688a13f9cfa02afce51a5 (patch)
treece633594c7529a5249143261dd760664e7a2cfbe /bfd/elfcode.h
parentce9116fdbfba8926a7bc25613d39bc3b2ed942fc (diff)
Support %Lx, %Lu, %Ld in _bfd_error_handler format
One way to print 64-bit bfd_vma or bfd_size_type values on 32-bit hosts is to cast the value to long long and use the 'll' modifier in printf format strings. However, that's awkward because we also support the Microsoft C library printf that uses 'I64' as a modifier instead, and having variants of translated strings would not endear us to the translation project. So, rewrite the 'll' modifier in _doprint for Microsoft. Even with that capability it's not so nice for 32-bit code to need casts to long long, so this patch makes 'L' a modifier for bfd_vma rather than an alias for 'll'. I've then used the new 'L' modifier to fix selected format strings. * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for __MSVCRT__. Support "L" modifier for bfd_vma. Formatting. * elf.c (setup_group): Use "Lx" to print sh_size. (_bfd_elf_setup_sections): Remove unnecessary cast and print unknown section type in hex. (copy_special_section_fields): Style fix. (bfd_section_from_shdr): Correct format for sh_link. Use a common error message for all the variants of unrecognized section types. (assign_file_positions_for_load_sections): Use "Lx" for lma adjust error message. (assign_file_positions_for_non_load_sections): Formatting. (rewrite_elf_program_header): Formatting. Use "Lx" for bfd_vma values in error messages. * elfcode.h (elf_slurp_reloc_table_from_section): Cast ELF_R_SYM value to type expected by format. * elflink.c (elf_link_read_relocs_from_section): Use "Lx" in error messages. (elf_link_add_object_symbols): Use "Lu" for symbol sizes. (elf_link_input_bfd): Use "Lx" for r_info. (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index ef097f739c..cbc534fe00 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1446,7 +1446,7 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
_bfd_error_handler
/* xgettext:c-format */
(_("%B(%A): relocation %d has invalid symbol index %ld"),
- abfd, asect, i, ELF_R_SYM (rela.r_info));
+ abfd, asect, i, (long) ELF_R_SYM (rela.r_info));
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
}
else