From 871b3ab29e87cf0de15f7e49ad19acc4f7f6f84c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 19 Feb 2018 15:21:40 +1030 Subject: Use %pA and %pB in messages rather than %A and %B First step towards compiler verification of _bfd_error_handler arguments, and better verification of translated messages. bfd/ * bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place of %A and %B. * aout-adobe.c: Update all messages using %A and %B. * aout-cris.c: Likewise. * aoutx.h: Likewise. * archive.c: Likewise. * binary.c: Likewise. * cache.c: Likewise. * coff-alpha.c: Likewise. * coff-arm.c: Likewise. * coff-i860.c: Likewise. * coff-mcore.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic4x.c: Likewise. * coff-tic54x.c: Likewise. * coff-tic80.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * coffswap.h: Likewise. * compress.c: Likewise. * cpu-arm.c: Likewise. * ecoff.c: Likewise. * elf-attrs.c: Likewise. * elf-eh-frame.c: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-properties.c: Likewise. * elf-s390-common.c: Likewise. * elf.c: Likewise. * elf32-arc.c: Likewise. * elf32-arm.c: Likewise. * elf32-avr.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-d10v.c: Likewise. * elf32-d30v.c: Likewise. * elf32-epiphany.c: Likewise. * elf32-fr30.c: Likewise. * elf32-frv.c: Likewise. * elf32-gen.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i370.c: Likewise. * elf32-i386.c: Likewise. * elf32-i960.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc12.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mcore.c: Likewise. * elf32-mep.c: Likewise. * elf32-metag.c: Likewise. * elf32-microblaze.c: Likewise. * elf32-moxie.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-nds32.c: Likewise. * elf32-nios2.c: Likewise. * elf32-or1k.c: Likewise. * elf32-pj.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-rx.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-sh64.c: Likewise. * elf32-sparc.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-v850.c: Likewise. * elf32-vax.c: Likewise. * elf32-visium.c: Likewise. * elf32-wasm32.c: Likewise. * elf32-xgate.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-gen.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-sparc.c: Likewise. * elf64-x86-64.c: Likewise. * elfcode.h: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfnn-aarch64.c: Likewise. * elfnn-ia64.c: Likewise. * elfnn-riscv.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.c: Likewise. * hpux-core.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * libbfd.c: Likewise. * linker.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * oasys.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * peXXigen.c: Likewise. * peicode.h: Likewise. * reloc.c: Likewise. * rs6000-core.c: Likewise. * srec.c: Likewise. * stabs.c: Likewise. * vms-alpha.c: Likewise. * xcofflink.c: Likewise. ld/ * ldmisc.c (vfinfo): Handle %pA and %pB in place of %A and %B. * ldcref.c: Update all messages using %A and %B. * ldexp.c: Likewise. * ldlang.c: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * pe-dll.c: Likewise. * plugin.c: Likewise. * emultempl/beos.em: Likewise. * emultempl/cr16elf.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/m68kelf.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/nds32elf.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/xtensaelf.em: Likewise. --- ld/ChangeLog | 23 +++++++++ ld/emultempl/beos.em | 4 +- ld/emultempl/cr16elf.em | 10 ++-- ld/emultempl/elf32.em | 20 ++++---- ld/emultempl/m68kcoff.em | 10 ++-- ld/emultempl/m68kelf.em | 14 +++--- ld/emultempl/mmo.em | 2 +- ld/emultempl/nds32elf.em | 4 +- ld/emultempl/pe.em | 8 ++-- ld/emultempl/pep.em | 6 +-- ld/emultempl/spuelf.em | 2 +- ld/emultempl/sunos.em | 8 ++-- ld/emultempl/xtensaelf.em | 10 ++-- ld/ldcref.c | 14 +++--- ld/ldexp.c | 2 +- ld/ldlang.c | 32 ++++++------- ld/ldmain.c | 48 +++++++++---------- ld/ldmisc.c | 117 ++++++++++++++++++++++++---------------------- ld/pe-dll.c | 6 +-- ld/plugin.c | 2 +- 20 files changed, 185 insertions(+), 157 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 6d9ccc5..db07d03 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,26 @@ +2018-02-19 Alan Modra + + * ldmisc.c (vfinfo): Handle %pA and %pB in place of %A and %B. + * ldcref.c: Update all messages using %A and %B. + * ldexp.c: Likewise. + * ldlang.c: Likewise. + * ldmain.c: Likewise. + * ldmisc.c: Likewise. + * pe-dll.c: Likewise. + * plugin.c: Likewise. + * emultempl/beos.em: Likewise. + * emultempl/cr16elf.em: Likewise. + * emultempl/elf32.em: Likewise. + * emultempl/m68kcoff.em: Likewise. + * emultempl/m68kelf.em: Likewise. + * emultempl/mmo.em: Likewise. + * emultempl/nds32elf.em: Likewise. + * emultempl/pe.em: Likewise. + * emultempl/pep.em: Likewise. + * emultempl/spuelf.em: Likewise. + * emultempl/sunos.em: Likewise. + * emultempl/xtensaelf.em: Likewise. + 2018-02-19 H.J. Lu PR ld/22845 diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em index d9eab40..ce59a09 100644 --- a/ld/emultempl/beos.em +++ b/ld/emultempl/beos.em @@ -433,14 +433,14 @@ sort_by_file_name (const void *a, const void *b) (*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type) sizeof(a_sec))) - einfo (_("%F%B: Can't read contents of section .idata: %E\n"), + einfo (_("%F%pB: Can't read contents of section .idata: %E\n"), (*ra)->input_section.section->owner); if (!bfd_get_section_contents ((*rb)->input_section.section->owner, (*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type) sizeof(b_sec))) - einfo (_("%F%B: Can't read contents of section .idata: %E\n"), + einfo (_("%F%pB: Can't read contents of section .idata: %E\n"), (*rb)->input_section.section->owner); i = a_sec < b_sec ? -1 : 0; diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em index d9f8bfc..710db1a 100644 --- a/ld/emultempl/cr16elf.em +++ b/ld/emultempl/cr16elf.em @@ -57,7 +57,7 @@ cr16_elf_after_open (void) COFF and ELF. */ if (bfd_get_flavour (abfd) != bfd_target_coff_flavour && bfd_get_flavour (abfd) != bfd_target_elf_flavour) - einfo (_("%F%B: all input objects must be COFF or ELF " + einfo (_("%F%pB: all input objects must be COFF or ELF " "for --embedded-relocs\n")); datasec = bfd_get_section_by_name (abfd, ".data.rel"); @@ -83,7 +83,7 @@ cr16_elf_after_open (void) || ! bfd_set_section_alignment (abfd, relsec, 2) || ! bfd_set_section_size (abfd, relsec, datasec->reloc_count * 8)) - einfo (_("%F%B: can not create .emreloc section: %E\n")); + einfo (_("%F%pB: can not create .emreloc section: %E\n")); } /* Double check that all other data sections are empty, as is @@ -102,7 +102,7 @@ check_sections (bfd *abfd, asection *sec, void *datasec) if ((strncmp (bfd_get_section_name (abfd, sec), ".data.rel", 9) == 0) && sec != datasec && sec->reloc_count == 0 ) - einfo (_("%B%X: section %s has relocs; can not use --embedded-relocs\n"), + einfo (_("%pB%X: section %s has relocs; can not use --embedded-relocs\n"), abfd, bfd_get_section_name (abfd, sec)); } @@ -158,10 +158,10 @@ cr16elf_before_allocation (void) &errmsg)) { if (errmsg == NULL) - einfo (_("%B%X: can not create runtime reloc information: %E\n"), + einfo (_("%pB%X: can not create runtime reloc information: %E\n"), abfd); else - einfo (_("%X%B: can not create runtime reloc information: %s\n"), + einfo (_("%X%pB: can not create runtime reloc information: %s\n"), abfd, errmsg); } } diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index c0925fc..eb90743 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -156,7 +156,7 @@ gld${EMULATION_NAME}_load_symbols (lang_input_statement_type *entry) if (entry->flags.just_syms && (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) != 0) - einfo (_("%P%F: --just-symbols may not be used on DSO: %B\n"), + einfo (_("%P%F: --just-symbols may not be used on DSO: %pB\n"), entry->the_bfd); if (link_class == 0 @@ -279,7 +279,7 @@ gld${EMULATION_NAME}_stat_needed (lang_input_statement_type *s) if (bfd_stat (s->the_bfd, &st) != 0) { - einfo (_("%P:%B: bfd_stat failed: %E\n"), s->the_bfd); + einfo (_("%P:%pB: bfd_stat failed: %E\n"), s->the_bfd); return; } @@ -319,7 +319,7 @@ gld${EMULATION_NAME}_stat_needed (lang_input_statement_type *s) soname = lbasename (s->filename); if (filename_ncmp (soname, global_needed->name, suffix - global_needed->name) == 0) - einfo (_("%P: warning: %s, needed by %B, may conflict with %s\n"), + einfo (_("%P: warning: %s, needed by %pB, may conflict with %s\n"), global_needed->name, global_needed->by, soname); } @@ -381,7 +381,7 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed, struct bfd_link_needed_list *needs; if (! bfd_elf_get_bfd_needed_list (abfd, &needs)) - einfo (_("%F%P:%B: bfd_elf_get_bfd_needed_list failed: %E\n"), abfd); + einfo (_("%F%P:%pB: bfd_elf_get_bfd_needed_list failed: %E\n"), abfd); if (needs != NULL) { @@ -438,7 +438,7 @@ fragment <filename); @@ -474,7 +474,7 @@ fragment <name; nn.by = l->by; if (verbose) - info_msg (_("%s needed by %B\n"), l->name, l->by); + info_msg (_("%s needed by %pB\n"), l->name, l->by); /* As-needed libs specified on the command line (or linker script) take priority over libs found in search dirs. */ @@ -1541,7 +1541,7 @@ fragment <name, l->by); } @@ -1820,7 +1820,7 @@ ${ELF_INTERPRETER_SET_DEFAULT} msg = (char *) xmalloc ((size_t) (sz + 1)); if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz)) - einfo (_("%F%B: Can't read contents of section .gnu.warning: %E\n"), + einfo (_("%F%pB: Can't read contents of section .gnu.warning: %E\n"), is->the_bfd); msg[sz] = '\0'; (*link_info.callbacks->warning) (&link_info, msg, diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em index dd5bea2..92b0848 100644 --- a/ld/emultempl/m68kcoff.em +++ b/ld/emultempl/m68kcoff.em @@ -74,7 +74,7 @@ gld${EMULATION_NAME}_after_open (void) /* As first-order business, make sure that each input BFD is COFF. It better be, as we are directly calling a COFF backend function. */ if (bfd_get_flavour (abfd) != bfd_target_coff_flavour) - einfo (_("%F%B: all input objects must be COFF " + einfo (_("%F%pB: all input objects must be COFF " "for --embedded-relocs\n")); datasec = bfd_get_section_by_name (abfd, ".data"); @@ -99,7 +99,7 @@ gld${EMULATION_NAME}_after_open (void) || ! bfd_set_section_alignment (abfd, relsec, 2) || ! bfd_set_section_size (abfd, relsec, datasec->reloc_count * 12)) - einfo (_("%F%B: can not create .emreloc section: %E\n")); + einfo (_("%F%pB: can not create .emreloc section: %E\n")); } /* Double check that all other data sections are empty, as is @@ -117,7 +117,7 @@ check_sections (bfd *abfd, asection *sec, void *datasec) if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) && sec != datasec && sec->reloc_count != 0) - einfo (_("%B%X: section %s has relocs; can not use --embedded-relocs\n"), + einfo (_("%pB%X: section %s has relocs; can not use --embedded-relocs\n"), abfd, bfd_get_section_name (abfd, sec)); } @@ -152,10 +152,10 @@ gld${EMULATION_NAME}_after_allocation (void) &errmsg)) { if (errmsg == NULL) - einfo (_("%B%X: can not create runtime reloc information: %E\n"), + einfo (_("%pB%X: can not create runtime reloc information: %E\n"), abfd); else - einfo (_("%X%B: can not create runtime reloc information: %s\n"), + einfo (_("%X%pB: can not create runtime reloc information: %s\n"), abfd, errmsg); } } diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em index 9258ad5..63c0be4 100644 --- a/ld/emultempl/m68kelf.em +++ b/ld/emultempl/m68kelf.em @@ -85,7 +85,7 @@ m68k_elf_after_open (void) COFF and ELF. */ if (bfd_get_flavour (abfd) != bfd_target_coff_flavour && bfd_get_flavour (abfd) != bfd_target_elf_flavour) - einfo (_("%F%B: all input objects must be COFF or ELF " + einfo (_("%F%pB: all input objects must be COFF or ELF " "for --embedded-relocs\n")); datasec = bfd_get_section_by_name (abfd, ".data"); @@ -110,7 +110,7 @@ m68k_elf_after_open (void) || ! bfd_set_section_alignment (abfd, relsec, 2) || ! bfd_set_section_size (abfd, relsec, datasec->reloc_count * 12)) - einfo (_("%F%B: can not create .emreloc section: %E\n")); + einfo (_("%F%pB: can not create .emreloc section: %E\n")); } /* Double check that all other data sections are empty, as is @@ -131,7 +131,7 @@ check_sections (bfd *abfd, asection *sec, void *datasec) if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) && sec != datasec && sec->reloc_count != 0) - einfo (_("%B%X: section %s has relocs; can not use --embedded-relocs\n"), + einfo (_("%pB%X: section %s has relocs; can not use --embedded-relocs\n"), abfd, bfd_get_section_name (abfd, sec)); } @@ -174,11 +174,11 @@ m68k_elf_after_allocation (void) &errmsg)) { if (errmsg == NULL) - einfo (_("%B%X: can not create " + einfo (_("%pB%X: can not create " "runtime reloc information: %E\n"), abfd); else - einfo (_("%X%B: can not create " + einfo (_("%X%pB: can not create " "runtime reloc information: %s\n"), abfd, errmsg); } @@ -190,11 +190,11 @@ m68k_elf_after_allocation (void) &errmsg)) { if (errmsg == NULL) - einfo (_("%B%X: can not create " + einfo (_("%pB%X: can not create " "runtime reloc information: %E\n"), abfd); else - einfo (_("%X%B: can not create " + einfo (_("%X%pB: can not create " "runtime reloc information: %s\n"), abfd, errmsg); } diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em index deb2a73..20572c3 100644 --- a/ld/emultempl/mmo.em +++ b/ld/emultempl/mmo.em @@ -228,7 +228,7 @@ mmo_after_open (void) { if (bfd_get_flavour (is->the_bfd) == bfd_target_elf_flavour && !_bfd_mmix_check_all_relocs (is->the_bfd, &link_info)) - einfo (_("%X%P: Internal problems scanning %B after opening it"), + einfo (_("%X%P: Internal problems scanning %pB after opening it"), is->the_bfd); } } diff --git a/ld/emultempl/nds32elf.em b/ld/emultempl/nds32elf.em index 27b3b0c..cfbf76e 100644 --- a/ld/emultempl/nds32elf.em +++ b/ld/emultempl/nds32elf.em @@ -121,7 +121,7 @@ nds32_elf_after_open (void) && abi_ver != (elf_elfheader (abfd)->e_flags & EF_NDS_ABI)) { /* Incompatible objects. */ - einfo (_("%F%B: ABI version of object files mismatched\n"), abfd); + einfo (_("%F%pB: ABI version of object files mismatched\n"), abfd); } #if defined NDS32_EX9_EXT @@ -166,7 +166,7 @@ nds32_elf_after_open (void) if (bfd_link_pic (&link_info)) { /* For PIE or shared object, all input must be PIC. */ - einfo (_("%B: must use -fpic to compile this file " + einfo (_("%pB: must use -fpic to compile this file " "for shared object or PIE\n"), abfd); } else diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 339b7c5..36856ce 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1220,7 +1220,7 @@ pe_find_data_imports (void) if (!bfd_generic_link_read_symbols (b)) { - einfo (_("%B%F: could not read symbols: %E\n"), b); + einfo (_("%pB%F: could not read symbols: %E\n"), b); return; } @@ -1484,7 +1484,7 @@ gld_${EMULATION_NAME}_after_open (void) if (coff_data (link_info.output_bfd) == NULL || coff_data (link_info.output_bfd)->pe == 0) - einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"), + einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'.\n"), link_info.output_bfd); pe_data (link_info.output_bfd)->pe_opthdr = pe; @@ -1616,7 +1616,7 @@ gld_${EMULATION_NAME}_after_open (void) if (!bfd_generic_link_read_symbols (is->the_bfd)) { - einfo (_("%B%F: could not read symbols: %E\n"), + einfo (_("%pB%F: could not read symbols: %E\n"), is->the_bfd); return; } @@ -1823,7 +1823,7 @@ gld_${EMULATION_NAME}_after_open (void) if (!bfd_generic_link_read_symbols (is->the_bfd)) { - einfo (_("%B%F: could not read symbols: %E\n"), + einfo (_("%pB%F: could not read symbols: %E\n"), is->the_bfd); return; } diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index c253d2f..ad48426 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -1186,7 +1186,7 @@ pep_find_data_imports (void) if (!bfd_generic_link_read_symbols (b)) { - einfo (_("%B%F: could not read symbols: %E\n"), b); + einfo (_("%pB%F: could not read symbols: %E\n"), b); return; } @@ -1452,7 +1452,7 @@ gld_${EMULATION_NAME}_after_open (void) if (coff_data (link_info.output_bfd) == NULL || coff_data (link_info.output_bfd)->pe == 0) - einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"), + einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'.\n"), link_info.output_bfd); pe_data (link_info.output_bfd)->pe_opthdr = pep; @@ -1562,7 +1562,7 @@ gld_${EMULATION_NAME}_after_open (void) if (!bfd_generic_link_read_symbols (is->the_bfd)) { - einfo (_("%B%F: could not read symbols: %E\n"), + einfo (_("%pB%F: could not read symbols: %E\n"), is->the_bfd); return; } diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em index ec70185..90c8531 100644 --- a/ld/emultempl/spuelf.em +++ b/ld/emultempl/spuelf.em @@ -426,7 +426,7 @@ gld${EMULATION_NAME}_finish (void) s = spu_elf_check_vma (&link_info); if (s != NULL && !params.auto_overlay) - einfo (_("%X%P: %A exceeds local store range\n"), s); + einfo (_("%X%P: %pA exceeds local store range\n"), s); } else if (params.auto_overlay) einfo (_("%P: --auto-overlay ignored with zero local store range\n")); diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em index bfea49e..daa94ef 100644 --- a/ld/emultempl/sunos.em +++ b/ld/emultempl/sunos.em @@ -427,11 +427,11 @@ gld${EMULATION_NAME}_after_open (void) { /* We've found the needed dynamic object. */ if (! bfd_link_add_symbols (abfd, &link_info)) - einfo (_("%F%B: error adding symbols: %E\n"), abfd); + einfo (_("%F%pB: error adding symbols: %E\n"), abfd); } else { - einfo (_("%P: warning: %s, needed by %B, not found\n"), + einfo (_("%P: warning: %s, needed by %pB, not found\n"), lname, l->by); } @@ -491,7 +491,7 @@ fragment <name, l->by); } } @@ -574,7 +574,7 @@ gld${EMULATION_NAME}_try_needed (const char *dir, const char *name) /* Add this file into the symbol table. */ if (! bfd_link_add_symbols (abfd, &link_info)) - einfo (_("%F%B: error adding symbols: %E\n"), abfd); + einfo (_("%F%pB: error adding symbols: %E\n"), abfd); return TRUE; } diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em index 2fc31eb..b88f5f1 100644 --- a/ld/emultempl/xtensaelf.em +++ b/ld/emultempl/xtensaelf.em @@ -267,7 +267,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec) if (! replace_insn_sec_with_prop_sec (abfd, insn_sec_name, prop_sec_name, &message)) { - einfo (_("%P: warning: failed to convert %s table in %B (%s); subsequent disassembly may be incomplete\n"), + einfo (_("%P: warning: failed to convert %s table in %pB (%s); subsequent disassembly may be incomplete\n"), insn_sec_name, abfd, message); } } @@ -384,7 +384,7 @@ check_xtensa_info (bfd *abfd, asection *info_sec) data = xmalloc (info_sec->size); if (! bfd_get_section_contents (abfd, info_sec, data, 0, info_sec->size)) - einfo (_("%F%P:%B: cannot read contents of section %A\n"), abfd, info_sec); + einfo (_("%F%P:%pB: cannot read contents of section %pA\n"), abfd, info_sec); if (info_sec->size > 24 && info_sec->size >= 24 + bfd_get_32 (abfd, data + 4) @@ -395,11 +395,11 @@ check_xtensa_info (bfd *abfd, asection *info_sec) &mismatch, &errmsg)) { if (mismatch) - einfo (_("%P:%B: warning: incompatible Xtensa configuration (%s)\n"), + einfo (_("%P:%pB: warning: incompatible Xtensa configuration (%s)\n"), abfd, errmsg); } else - einfo (_("%P:%B: warning: cannot parse .xtensa.info section\n"), abfd); + einfo (_("%P:%pB: warning: cannot parse .xtensa.info section\n"), abfd); free (data); } @@ -450,7 +450,7 @@ elf_xtensa_before_allocation (void) cannot go any further if there are any mismatches. */ if ((is_big_endian && f->the_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE) || (!is_big_endian && f->the_bfd->xvec->byteorder == BFD_ENDIAN_BIG)) - einfo (_("%F%P: cross-endian linking for %B not supported\n"), + einfo (_("%F%P: cross-endian linking for %pB not supported\n"), f->the_bfd); if (! first_bfd) diff --git a/ld/ldcref.c b/ld/ldcref.c index 89ffdef..2b8eb02 100644 --- a/ld/ldcref.c +++ b/ld/ldcref.c @@ -452,7 +452,7 @@ output_one_cref (FILE *fp, struct cref_hash_entry *h) putc (' ', fp); ++len; } - lfinfo (fp, "%B\n", r->abfd); + lfinfo (fp, "%pB\n", r->abfd); len = 0; } } @@ -466,7 +466,7 @@ output_one_cref (FILE *fp, struct cref_hash_entry *h) putc (' ', fp); ++len; } - lfinfo (fp, "%B\n", r->abfd); + lfinfo (fp, "%pB\n", r->abfd); len = 0; } } @@ -480,7 +480,7 @@ output_one_cref (FILE *fp, struct cref_hash_entry *h) putc (' ', fp); ++len; } - lfinfo (fp, "%B\n", r->abfd); + lfinfo (fp, "%pB\n", r->abfd); len = 0; } } @@ -514,7 +514,7 @@ check_local_sym_xref (lang_input_statement_type *statement) return; if (!bfd_generic_link_read_symbols (abfd)) - einfo (_("%B%F: could not read symbols: %E\n"), abfd); + einfo (_("%pB%F: could not read symbols: %E\n"), abfd); for (syms = bfd_get_outsymbols (abfd); *syms; ++syms) { @@ -625,7 +625,7 @@ check_refs (const char *name, BFD might contain a prohibited cross reference. */ if (!bfd_generic_link_read_symbols (abfd)) - einfo (_("%B%F: could not read symbols: %E\n"), abfd); + einfo (_("%pB%F: could not read symbols: %E\n"), abfd); info.sym_name = name; info.global = global; @@ -687,14 +687,14 @@ check_reloc_refs (bfd *abfd, asection *sec, void *iarg) relsize = bfd_get_reloc_upper_bound (abfd, sec); if (relsize < 0) - einfo (_("%B%F: could not read relocs: %E\n"), abfd); + einfo (_("%pB%F: could not read relocs: %E\n"), abfd); if (relsize == 0) return; relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols); if (relcount < 0) - einfo (_("%B%F: could not read relocs: %E\n"), abfd); + einfo (_("%pB%F: could not read relocs: %E\n"), abfd); p = relpp; pend = p + relcount; diff --git a/ld/ldexp.c b/ld/ldexp.c index bf0df44..6d1caca 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -1415,7 +1415,7 @@ exp_print_tree (etree_type *tree) return; case etree_rel: if (tree->rel.section->owner != NULL) - minfo ("%B:", tree->rel.section->owner); + minfo ("%pB:", tree->rel.section->owner); minfo ("%s+0x%v", tree->rel.section->name, tree->rel.value); return; case etree_assign: diff --git a/ld/ldlang.c b/ld/ldlang.c index 001039d..2581a77 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2016,7 +2016,7 @@ lang_print_asneeded (void) } if (m->ref != NULL) - minfo ("%B ", m->ref); + minfo ("%pB ", m->ref); minfo ("(%T)\n", m->name); } } @@ -2770,15 +2770,15 @@ load_symbols (lang_input_statement_type *entry, { char **p; - einfo (_("%B: file not recognized: %E\n"), entry->the_bfd); - einfo (_("%B: matching formats:"), entry->the_bfd); + einfo (_("%pB: file not recognized: %E\n"), entry->the_bfd); + einfo (_("%pB: matching formats:"), entry->the_bfd); for (p = matching; *p != NULL; p++) einfo (" %s", *p); einfo ("%F\n"); } else if (err != bfd_error_file_not_recognized || place == NULL) - einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd); + einfo (_("%F%pB: file not recognized: %E\n"), entry->the_bfd); bfd_close (entry->the_bfd); entry->the_bfd = NULL; @@ -2851,7 +2851,7 @@ load_symbols (lang_input_statement_type *entry, if (!bfd_check_format (member, bfd_object)) { - einfo (_("%F%B: member %B in archive is not an object\n"), + einfo (_("%F%pB: member %pB in archive is not an object\n"), entry->the_bfd, member); loaded = FALSE; } @@ -2866,7 +2866,7 @@ load_symbols (lang_input_statement_type *entry, substitute BFD for us. */ if (!bfd_link_add_symbols (subsbfd, &link_info)) { - einfo (_("%F%B: error adding symbols: %E\n"), member); + einfo (_("%F%pB: error adding symbols: %E\n"), member); loaded = FALSE; } } @@ -2880,7 +2880,7 @@ load_symbols (lang_input_statement_type *entry, if (bfd_link_add_symbols (entry->the_bfd, &link_info)) entry->flags.loaded = TRUE; else - einfo (_("%F%B: error adding symbols: %E\n"), entry->the_bfd); + einfo (_("%F%pB: error adding symbols: %E\n"), entry->the_bfd); return entry->flags.loaded; } @@ -4230,7 +4230,7 @@ print_input_section (asection *i, bfd_boolean is_discarded) size = 0; } - minfo ("0x%V %W %B\n", addr, size, i->owner); + minfo ("0x%V %W %pB\n", addr, size, i->owner); if (size != i->rawsize && i->rawsize != 0) { @@ -4955,7 +4955,7 @@ os_region_check (lang_output_section_statement_type *os, { if (tree != NULL) { - einfo (_("%X%P: address 0x%v of %B section `%s'" + einfo (_("%X%P: address 0x%v of %pB section `%s'" " is not within region `%s'\n"), region->current, os->bfd_section->owner, @@ -4966,7 +4966,7 @@ os_region_check (lang_output_section_statement_type *os, { region->had_full_message = TRUE; - einfo (_("%X%P: %B section `%s' will not fit in region `%s'\n"), + einfo (_("%X%P: %pB section `%s' will not fit in region `%s'\n"), os->bfd_section->owner, os->bfd_section->name, region->name_list.name); @@ -6291,7 +6291,7 @@ lang_check (void) && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0) { einfo (_("%P%F: Relocatable linking with relocations from" - " format %s (%B) to format %s (%B) is not supported\n"), + " format %s (%pB) to format %s (%pB) is not supported\n"), bfd_get_target (input_bfd), input_bfd, bfd_get_target (link_info.output_bfd), link_info.output_bfd); /* einfo with %F exits. */ @@ -6300,7 +6300,7 @@ lang_check (void) if (compatible == NULL) { if (command_line.warn_mismatch) - einfo (_("%P%X: %s architecture of input file `%B'" + einfo (_("%P%X: %s architecture of input file `%pB'" " is incompatible with %s output\n"), bfd_printable_name (input_bfd), input_bfd, bfd_printable_name (link_info.output_bfd)); @@ -6323,7 +6323,7 @@ lang_check (void) { if (command_line.warn_mismatch) einfo (_("%P%X: failed to merge target specific data" - " of file %B\n"), input_bfd); + " of file %pB\n"), input_bfd); } if (!command_line.warn_mismatch) bfd_set_error_handler (pfn); @@ -6449,7 +6449,7 @@ lang_one_common (struct bfd_link_hash_entry *h, void *info) ++len; } - minfo ("%B\n", section->owner); + minfo ("%pB\n", section->owner); } return TRUE; @@ -6480,7 +6480,7 @@ ldlang_place_orphan (asection *s) int constraint = 0; if (config.orphan_handling == orphan_handling_error) - einfo (_("%X%P: error: unplaced orphan section `%A' from `%B'.\n"), + einfo (_("%X%P: error: unplaced orphan section `%pA' from `%pB'.\n"), s, s->owner); if (config.unique_orphan_sections || unique_section_p (s, NULL)) @@ -6498,7 +6498,7 @@ ldlang_place_orphan (asection *s) } if (config.orphan_handling == orphan_handling_warn) - einfo (_("%P: warning: orphan section `%A' from `%B' being " + einfo (_("%P: warning: orphan section `%pA' from `%pB' being " "placed in section `%s'.\n"), s, s->owner, os->name); } diff --git a/ld/ldmain.c b/ld/ldmain.c index c473ed2..d23c6d1 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -481,7 +481,7 @@ main (int argc, char **argv) else { if (!bfd_close (link_info.output_bfd)) - einfo (_("%F%B: final close failed: %E\n"), link_info.output_bfd); + einfo (_("%F%pB: final close failed: %E\n"), link_info.output_bfd); /* If the --force-exe-suffix is enabled, and we're making an executable file and it doesn't end in .exe, copy it to one @@ -904,7 +904,7 @@ add_archive_element (struct bfd_link_info *info, } if (from != NULL) - minfo ("%B ", from); + minfo ("%pB ", from); if (h != NULL) minfo ("(%T)\n", h->root.string); else @@ -1038,43 +1038,43 @@ multiple_common (struct bfd_link_info *info ATTRIBUTE_UNUSED, || ntype == bfd_link_hash_indirect) { ASSERT (otype == bfd_link_hash_common); - einfo (_("%B: warning: definition of `%T' overriding common\n"), + einfo (_("%pB: warning: definition of `%T' overriding common\n"), nbfd, name); if (obfd != NULL) - einfo (_("%B: warning: common is here\n"), obfd); + einfo (_("%pB: warning: common is here\n"), obfd); } else if (otype == bfd_link_hash_defined || otype == bfd_link_hash_defweak || otype == bfd_link_hash_indirect) { ASSERT (ntype == bfd_link_hash_common); - einfo (_("%B: warning: common of `%T' overridden by definition\n"), + einfo (_("%pB: warning: common of `%T' overridden by definition\n"), nbfd, name); if (obfd != NULL) - einfo (_("%B: warning: defined here\n"), obfd); + einfo (_("%pB: warning: defined here\n"), obfd); } else { ASSERT (otype == bfd_link_hash_common && ntype == bfd_link_hash_common); if (osize > nsize) { - einfo (_("%B: warning: common of `%T' overridden by larger common\n"), + einfo (_("%pB: warning: common of `%T' overridden by larger common\n"), nbfd, name); if (obfd != NULL) - einfo (_("%B: warning: larger common is here\n"), obfd); + einfo (_("%pB: warning: larger common is here\n"), obfd); } else if (nsize > osize) { - einfo (_("%B: warning: common of `%T' overriding smaller common\n"), + einfo (_("%pB: warning: common of `%T' overriding smaller common\n"), nbfd, name); if (obfd != NULL) - einfo (_("%B: warning: smaller common is here\n"), obfd); + einfo (_("%pB: warning: smaller common is here\n"), obfd); } else { - einfo (_("%B: warning: multiple common of `%T'\n"), nbfd, name); + einfo (_("%pB: warning: multiple common of `%T'\n"), nbfd, name); if (obfd != NULL) - einfo (_("%B: warning: previous common is here\n"), obfd); + einfo (_("%pB: warning: previous common is here\n"), obfd); } } } @@ -1183,7 +1183,7 @@ symbol_warning (const char *warning, const char *symbol, bfd *abfd) struct warning_callback_info cinfo; if (!bfd_generic_link_read_symbols (abfd)) - einfo (_("%B%F: could not read symbols: %E\n"), abfd); + einfo (_("%pB%F: could not read symbols: %E\n"), abfd); cinfo.found = FALSE; cinfo.warning = warning; @@ -1214,7 +1214,7 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED, else if (abfd == NULL) einfo ("%P: %s%s\n", _("warning: "), warning); else if (symbol == NULL) - einfo ("%B: %s%s\n", abfd, _("warning: "), warning); + einfo ("%pB: %s%s\n", abfd, _("warning: "), warning); else if (!symbol_warning (warning, symbol, abfd)) { bfd *b; @@ -1222,7 +1222,7 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED, for (b = info->input_bfds; b; b = b->link.next) if (b != abfd && symbol_warning (warning, symbol, b)) return; - einfo ("%B: %s%s\n", abfd, _("warning: "), warning); + einfo ("%pB: %s%s\n", abfd, _("warning: "), warning); } } @@ -1245,14 +1245,14 @@ warning_find_reloc (bfd *abfd, asection *sec, void *iarg) relsize = bfd_get_reloc_upper_bound (abfd, sec); if (relsize < 0) - einfo (_("%B%F: could not read relocs: %E\n"), abfd); + einfo (_("%pB%F: could not read relocs: %E\n"), abfd); if (relsize == 0) return; relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols); if (relcount < 0) - einfo (_("%B%F: could not read relocs: %E\n"), abfd); + einfo (_("%pB%F: could not read relocs: %E\n"), abfd); p = relpp; pend = p + relcount; @@ -1341,19 +1341,19 @@ undefined_symbol (struct bfd_link_info *info, if (error_count < MAX_ERRORS_IN_A_ROW) { if (error) - einfo (_("%X%B: undefined reference to `%T'\n"), + einfo (_("%X%pB: undefined reference to `%T'\n"), abfd, name); else - einfo (_("%B: warning: undefined reference to `%T'\n"), + einfo (_("%pB: warning: undefined reference to `%T'\n"), abfd, name); } else if (error_count == MAX_ERRORS_IN_A_ROW) { if (error) - einfo (_("%X%B: more undefined references to `%T' follow\n"), + einfo (_("%X%pB: more undefined references to `%T' follow\n"), abfd, name); else - einfo (_("%B: warning: more undefined references to `%T' follow\n"), + einfo (_("%pB: warning: more undefined references to `%T' follow\n"), abfd, name); } else if (error) @@ -1410,7 +1410,7 @@ reloc_overflow (struct bfd_link_info *info, case bfd_link_hash_defined: case bfd_link_hash_defweak: einfo (_(" relocation truncated to fit: " - "%s against symbol `%T' defined in %A section in %B"), + "%s against symbol `%T' defined in %pA section in %pB"), reloc_name, entry->root.string, entry->u.def.section, entry->u.def.section == bfd_abs_section_ptr @@ -1486,9 +1486,9 @@ notice (struct bfd_link_info *info, && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL) { if (bfd_is_und_section (section)) - einfo (_("%B: reference to %s\n"), abfd, name); + einfo (_("%pB: reference to %s\n"), abfd, name); else - einfo (_("%B: definition of %s\n"), abfd, name); + einfo (_("%pB: definition of %s\n"), abfd, name); } if (command_line.cref || nocrossref_list != NULL) diff --git a/ld/ldmisc.c b/ld/ldmisc.c index 49aa66d..e3fdac3 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -40,8 +40,6 @@ /* %% literal % - %A section name from a section - %B filename from a bfd %C clever filename:linenumber with function %D like %C, but no function name %E current bfd error or errno @@ -60,6 +58,8 @@ %ld long, like printf %lu unsigned long, like printf %p native (host) void* pointer, like printf + %pA section name from a section + %pB filename from a bfd %s arbitrary string, like printf %u integer, like printf %v hex bfd_vma, no leading zeros @@ -130,16 +130,19 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) break; case 'T': - case 'A': - case 'B': case 'I': case 'S': case 'R': - case 'p': case 's': arg_type = Ptr; break; + case 'p': + if (*scan == 'A' || *scan == 'B') + scan++; + arg_type = Ptr; + break; + case 'C': case 'D': case 'G': @@ -316,49 +319,6 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) } break; - case 'A': - /* section name from a section */ - { - asection *sec; - bfd *abfd; - const char *group = NULL; - struct coff_comdat_info *ci; - - sec = (asection *) args[arg_no].p; - ++arg_count; - abfd = sec->owner; - fprintf (fp, "%s", sec->name); - if (abfd != NULL - && bfd_get_flavour (abfd) == bfd_target_elf_flavour - && elf_next_in_group (sec) != NULL - && (sec->flags & SEC_GROUP) == 0) - group = elf_group_name (sec); - else if (abfd != NULL - && bfd_get_flavour (abfd) == bfd_target_coff_flavour - && (ci = bfd_coff_get_comdat_section (sec->owner, - sec)) != NULL) - group = ci->name; - if (group != NULL) - fprintf (fp, "[%s]", group); - } - break; - - case 'B': - /* filename from a bfd */ - { - bfd *abfd = (bfd *) args[arg_no].p; - ++arg_count; - if (abfd == NULL) - fprintf (fp, "%s generated", program_name); - else if (abfd->my_archive != NULL - && !bfd_is_thin_archive (abfd->my_archive)) - fprintf (fp, "%s(%s)", abfd->my_archive->filename, - abfd->filename); - else - fprintf (fp, "%s", abfd->filename); - } - break; - case 'F': /* Error is fatal. */ fatal = TRUE; @@ -450,7 +410,7 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) if (abfd != NULL) { if (!bfd_generic_link_read_symbols (abfd)) - einfo (_("%B%F: could not read symbols: %E\n"), abfd); + einfo (_("%pB%F: could not read symbols: %E\n"), abfd); asymbols = bfd_get_outsymbols (abfd); } @@ -489,7 +449,7 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) && filename_cmp (last_file, filename) != 0) || strcmp (last_function, functionname) != 0) { - lfinfo (fp, _("%B: In function `%T':\n"), + lfinfo (fp, _("%pB: In function `%T':\n"), abfd, functionname); last_bfd = abfd; @@ -505,7 +465,7 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) discard_last = FALSE; } else - lfinfo (fp, "%B:", abfd); + lfinfo (fp, "%pB:", abfd); if (filename != NULL) fprintf (fp, "%s:", filename); @@ -520,11 +480,11 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) } else { - lfinfo (fp, "%B:", abfd); + lfinfo (fp, "%pB:", abfd); done = FALSE; } if (!done) - lfinfo (fp, "(%A+0x%v)", section, offset); + lfinfo (fp, "(%pA+0x%v)", section, offset); if (discard_last) { @@ -544,9 +504,54 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning) break; case 'p': - /* native (host) void* pointer, like printf */ - fprintf (fp, "%p", args[arg_no].p); - ++arg_count; + if (*fmt == 'A') + { + /* section name from a section */ + asection *sec; + bfd *abfd; + const char *group = NULL; + struct coff_comdat_info *ci; + + fmt++; + sec = (asection *) args[arg_no].p; + ++arg_count; + abfd = sec->owner; + fprintf (fp, "%s", sec->name); + if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_elf_flavour + && elf_next_in_group (sec) != NULL + && (sec->flags & SEC_GROUP) == 0) + group = elf_group_name (sec); + else if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_coff_flavour + && (ci = bfd_coff_get_comdat_section (sec->owner, + sec)) != NULL) + group = ci->name; + if (group != NULL) + fprintf (fp, "[%s]", group); + } + else if (*fmt == 'B') + { + /* filename from a bfd */ + bfd *abfd = (bfd *) args[arg_no].p; + + fmt++; + ++arg_count; + if (abfd == NULL) + fprintf (fp, "%s generated", program_name); + else if (abfd->my_archive != NULL + && !bfd_is_thin_archive (abfd->my_archive)) + fprintf (fp, "%s(%s)", abfd->my_archive->filename, + abfd->filename); + else + fprintf (fp, "%s", abfd->filename); + } + else + { + /* native (host) void* pointer, like printf */ + fprintf (fp, "%p", args[arg_no].p); + ++arg_count; + } break; case 's': diff --git a/ld/pe-dll.c b/ld/pe-dll.c index c398f23..d1bd32c 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -722,7 +722,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info * if (!bfd_generic_link_read_symbols (b)) { - einfo (_("%B%F: could not read symbols: %E\n"), b); + einfo (_("%pB%F: could not read symbols: %E\n"), b); return; } @@ -1301,7 +1301,7 @@ pe_walk_relocs_of_symbol (struct bfd_link_info *info, if (!bfd_generic_link_read_symbols (b)) { - einfo (_("%B%F: could not read symbols: %E\n"), b); + einfo (_("%pB%F: could not read symbols: %E\n"), b); return; } @@ -1396,7 +1396,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info) if (!bfd_generic_link_read_symbols (b)) { - einfo (_("%B%F: could not read symbols: %E\n"), b); + einfo (_("%pB%F: could not read symbols: %E\n"), b); return; } diff --git a/ld/plugin.c b/ld/plugin.c index 4384a46..0fb51c2 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -783,7 +783,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, report_symbol: syms[n].resolution = res; if (report_plugin_symbols) - einfo (_("%P: %B: symbol `%s' " + einfo (_("%P: %pB: symbol `%s' " "definition: %d, visibility: %d, resolution: %d\n"), abfd, syms[n].name, syms[n].def, syms[n].visibility, res); -- cgit v1.1