From: Alan Modra Date: Tue, 20 Feb 2018 08:59:09 +0000 (+1030) Subject: PPC error/warning messages X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf97bcb0c3f33460e9cfa57a2890df1c38a497d7;p=binutils-gdb.git PPC error/warning messages The GNU coding standard says error messages should be of the form program:sourcefile:lineno: message or program: message and "The string message should not begin with a capital letter when it follows a program name and/or file name, because that isn’t the beginning of a sentence. (The sentence conceptually starts at the beginning of the line.) Also, it should not end with a period." This patch does that for ppc, and removes some British spelling. I've also switched some error output from using the linker callback einfo to _bfd_error_handler, due to improved compilation time argument checking now done for the latter function. bfd/ * elf32-ppc.c: Standardize error/warning messages. Use _bfd_error_handler rather than einfo when einfo features not used. * elf64-ppc.c: Likewise. ld/ * testsuite/ld-powerpc/attr-gnu-12-21.d: Update. * testsuite/ld-powerpc/attr-gnu-4-12.d: Update. * testsuite/ld-powerpc/attr-gnu-4-13.d: Update. * testsuite/ld-powerpc/attr-gnu-4-21.d: Update. * testsuite/ld-powerpc/attr-gnu-4-23.d: Update. * testsuite/ld-powerpc/attr-gnu-4-31.d: Update. * testsuite/ld-powerpc/attr-gnu-4-32.d: Update. * testsuite/ld-powerpc/attr-gnu-8-23.d: Update. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 16186d8a2af..7f5b1b7a5d5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2018-02-26 Alan Modra + + * elf32-ppc.c: Standardize error/warning messages. Use + _bfd_error_handler rather than einfo when einfo features not used. + * elf64-ppc.c: Likewise. + 2018-02-23 Alan Modra PR 22881 diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 7d6196c0598..9b6a5cad28e 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2029,7 +2029,7 @@ ppc_elf_info_to_howto (bfd *abfd, if (r_type >= R_PPC_max) { /* xgettext:c-format */ - _bfd_error_handler (_("%pB: unrecognised PPC reloc number: %d"), + _bfd_error_handler (_("%pB: unsupported reloc type %#x"), abfd, r_type); bfd_set_error (bfd_error_bad_value); r_type = R_PPC_NONE; @@ -2041,7 +2041,7 @@ ppc_elf_info_to_howto (bfd *abfd, if (!cache_ptr->howto) { /* xgettext:c-format */ - _bfd_error_handler (_("%pB: invalid relocation type %d"), + _bfd_error_handler (_("%pB: unsupported reloc type %#x"), abfd, r_type); bfd_set_error (bfd_error_bad_value); @@ -2846,7 +2846,7 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) if (buffer == NULL) { _bfd_error_handler - (_("failed to allocate space for new APUinfo section.")); + (_("failed to allocate space for new APUinfo section")); return; } @@ -2865,10 +2865,10 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) } if (length != asec->size) - _bfd_error_handler (_("failed to compute new APUinfo section.")); + _bfd_error_handler (_("failed to compute new APUinfo section")); if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length)) - _bfd_error_handler (_("failed to install new APUinfo section.")); + _bfd_error_handler (_("failed to install new APUinfo section")); free (buffer); @@ -4638,20 +4638,20 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info) else if (out_fp != 2 && in_fp == 2) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses hard float, %pB uses soft float"), obfd, ibfd); + (_("warning: %pB uses hard float, %pB uses soft float"), obfd, ibfd); else if (out_fp == 2 && in_fp != 2) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses hard float, %pB uses soft float"), ibfd, obfd); + (_("warning: %pB uses hard float, %pB uses soft float"), ibfd, obfd); else if (out_fp == 1 && in_fp == 3) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses double-precision hard float, " + (_("warning: %pB uses double-precision hard float, " "%pB uses single-precision hard float"), obfd, ibfd); else if (out_fp == 3 && in_fp == 1) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses double-precision hard float, " + (_("warning: %pB uses double-precision hard float, " "%pB uses single-precision hard float"), ibfd, obfd); in_fp = in_attr->i & 0xc; @@ -4666,22 +4666,22 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *ibfd, struct bfd_link_info *info) else if (out_fp != 2 * 4 && in_fp == 2 * 4) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses 64-bit long double, " + (_("warning: %pB uses 64-bit long double, " "%pB uses 128-bit long double"), ibfd, obfd); else if (in_fp != 2 * 4 && out_fp == 2 * 4) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses 64-bit long double, " + (_("warning: %pB uses 64-bit long double, " "%pB uses 128-bit long double"), obfd, ibfd); else if (out_fp == 1 * 4 && in_fp == 3 * 4) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses IBM long double, " + (_("warning: %pB uses IBM long double, " "%pB uses IEEE long double"), ibfd, obfd); else if (out_fp == 3 * 4 && in_fp == 1 * 4) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses IBM long double, " + (_("warning: %pB uses IBM long double, " "%pB uses IEEE long double"), obfd, ibfd); } } @@ -4732,12 +4732,12 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info) else if (out_vec < in_vec) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses AltiVec vector ABI, %pB uses SPE vector ABI"), + (_("warning: %pB uses AltiVec vector ABI, %pB uses SPE vector ABI"), obfd, ibfd); else if (out_vec > in_vec) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses AltiVec vector ABI, %pB uses SPE vector ABI"), + (_("warning: %pB uses AltiVec vector ABI, %pB uses SPE vector ABI"), ibfd, obfd); } @@ -4760,12 +4760,12 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, struct bfd_link_info *info) else if (out_struct < in_struct) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses r3/r4 for small structure returns, " + (_("warning: %pB uses r3/r4 for small structure returns, " "%pB uses memory"), obfd, ibfd); else if (out_struct > in_struct) _bfd_error_handler /* xgettext:c-format */ - (_("Warning: %pB uses r3/r4 for small structure returns, " + (_("warning: %pB uses r3/r4 for small structure returns, " "%pB uses memory"), ibfd, obfd); } @@ -5007,10 +5007,9 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->plt_type == PLT_OLD && htab->params->plt_style == PLT_NEW) { if (htab->old_bfd != NULL) - info->callbacks->einfo (_("%P: bss-plt forced due to %pB\n"), - htab->old_bfd); + _bfd_error_handler (_("bss-plt forced due to %pB"), htab->old_bfd); else - info->callbacks->einfo (_("%P: bss-plt forced by profiling\n")); + _bfd_error_handler (_("bss-plt forced by profiling")); } BFD_ASSERT (htab->plt_type != PLT_VXWORKS); @@ -8341,10 +8340,9 @@ ppc_elf_relocate_section (bfd *output_bfd, switch (r_type) { default: - info->callbacks->einfo - /* xgettext:c-format */ - (_("%P: %pB: unknown relocation type %d for symbol %s\n"), - input_bfd, (int) r_type, sym_name); + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: %s unsupported"), + input_bfd, howto->name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -9099,10 +9097,10 @@ ppc_elf_relocate_section (bfd *output_bfd, if (!(strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)) { - info->callbacks->einfo + _bfd_error_handler /* xgettext:c-format */ - (_("%P: %pB: the target (%s) of a %s relocation is " - "in the wrong output section (%s)\n"), + (_("%pB: the target (%s) of a %s relocation is " + "in the wrong output section (%s)"), input_bfd, sym_name, howto->name, @@ -9130,10 +9128,10 @@ ppc_elf_relocate_section (bfd *output_bfd, if (!(strcmp (name, ".sdata2") == 0 || strcmp (name, ".sbss2") == 0)) { - info->callbacks->einfo + _bfd_error_handler /* xgettext:c-format */ - (_("%P: %pB: the target (%s) of a %s relocation is " - "in the wrong output section (%s)\n"), + (_("%pB: the target (%s) of a %s relocation is " + "in the wrong output section (%s)"), input_bfd, sym_name, howto->name, @@ -9221,10 +9219,10 @@ ppc_elf_relocate_section (bfd *output_bfd, } else { - info->callbacks->einfo + _bfd_error_handler /* xgettext:c-format */ - (_("%P: %pB: the target (%s) of a %s relocation is " - "in the wrong output section (%s)\n"), + (_("%pB: the target (%s) of a %s relocation is " + "in the wrong output section (%s)"), input_bfd, sym_name, howto->name, @@ -9417,12 +9415,9 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_EMB_RELST_HI: case R_PPC_EMB_RELST_HA: case R_PPC_EMB_BIT_FLD: - info->callbacks->einfo - /* xgettext:c-format */ - (_("%P: %pB: relocation %s is not yet supported for symbol %s\n"), - input_bfd, - howto->name, - sym_name); + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: %s unsupported"), + input_bfd, howto->name); bfd_set_error (bfd_error_invalid_operation); ret = FALSE; @@ -10407,11 +10402,10 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, else { /* xgettext:c-format */ - info->callbacks->einfo (_("%P: %s not defined in linker created %s\n"), - htab->elf.hgot->root.root.string, - (htab->elf.sgotplt != NULL - ? htab->elf.sgotplt->name - : htab->elf.sgot->name)); + _bfd_error_handler (_("%s not defined in linker created %pA"), + htab->elf.hgot->root.root.string, + (htab->elf.sgotplt != NULL + ? htab->elf.sgotplt : htab->elf.sgot)); bfd_set_error (bfd_error_bad_value); ret = FALSE; } diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index f8b6629d2d9..cebd7e2278b 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2514,8 +2514,8 @@ ppc64_elf_info_to_howto (bfd *abfd, arelent *cache_ptr, if (type >= ARRAY_SIZE (ppc64_elf_howto_table)) { /* xgettext:c-format */ - _bfd_error_handler (_("%pB: invalid relocation type %d"), - abfd, (int) type); + _bfd_error_handler (_("%pB: unsupported reloc type %#x"), + abfd, type); type = R_PPC64_NONE; } cache_ptr->howto = ppc64_elf_howto_table[type]; @@ -4647,8 +4647,8 @@ ppc_add_stub (const char *stub_name, if (stub_entry == NULL) { /* xgettext:c-format */ - info->callbacks->einfo (_("%P: %pB: cannot create stub entry %s\n"), - section->owner, stub_name); + _bfd_error_handler (_("%pB: cannot create stub entry %s"), + section->owner, stub_name); return NULL; } @@ -4978,8 +4978,8 @@ ppc64_elf_add_symbol_hook (bfd *ibfd, set_abiversion (ibfd, 2); else if (abiversion (ibfd) == 1) { - info->callbacks->einfo (_("%P: symbol '%s' has invalid st_other" - " for ABI version 1\n"), name); + _bfd_error_handler (_("symbol '%s' has invalid st_other" + " for ABI version 1"), *name); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5153,9 +5153,8 @@ ppc64_elf_before_check_relocs (bfd *ibfd, struct bfd_link_info *info) else if (abiversion (ibfd) >= 2) { /* xgettext:c-format */ - info->callbacks->einfo (_("%P: %pB .opd not allowed in ABI" - " version %d\n"), - ibfd, abiversion (ibfd)); + _bfd_error_handler (_("%pB .opd not allowed in ABI version %d"), + ibfd, abiversion (ibfd)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5653,7 +5652,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, ppc_howto_init (); /* xgettext:c-format */ info->callbacks->einfo (_("%H: %s reloc unsupported " - "in shared libraries and PIEs.\n"), + "in shared libraries and PIEs\n"), abfd, sec, rel->r_offset, ppc64_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); @@ -7756,8 +7755,8 @@ dec_dynrel_count (bfd_vma r_info, } /* xgettext:c-format */ - info->callbacks->einfo (_("%P: dynreloc miscount for %pB, section %pA\n"), - sec->owner, sec); + _bfd_error_handler (_("dynreloc miscount for %pB, section %pA"), + sec->owner, sec); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -8213,9 +8212,9 @@ ppc64_elf_tls_setup (struct bfd_link_info *info) if (htab->params->plt_localentry0 && elf_link_hash_lookup (&htab->elf, "GLIBC_2.26", FALSE, FALSE, FALSE) == NULL) - info->callbacks->einfo - (_("%P: warning: --plt-localentry is especially dangerous without " - "ld.so support to detect ABI violations.\n")); + _bfd_error_handler + (_("warning: --plt-localentry is especially dangerous without " + "ld.so support to detect ABI violations")); htab->tls_get_addr = ((struct ppc_link_hash_entry *) elf_link_hash_lookup (&htab->elf, ".__tls_get_addr", @@ -9173,7 +9172,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info) info->callbacks->einfo /* xgettext:c-format */ (_("%H: toc optimization is not supported for" - " %s instruction.\n"), + " %s instruction\n"), ibfd, sec, rel->r_offset & ~3, str); } } @@ -10867,8 +10866,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (off + (1 << 25) >= (bfd_vma) (1 << 26)) { - info->callbacks->einfo - (_("%P: long branch stub `%s' offset overflow\n"), + _bfd_error_handler + (_("long branch stub `%s' offset overflow"), stub_entry->root.string); htab->stub_error = TRUE; return FALSE; @@ -10927,8 +10926,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) FALSE, FALSE); if (br_entry == NULL) { - info->callbacks->einfo (_("%P: can't find branch stub `%s'\n"), - stub_entry->root.string); + _bfd_error_handler (_("can't find branch stub `%s'"), + stub_entry->root.string); htab->stub_error = TRUE; return FALSE; } @@ -11355,8 +11354,8 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) TRUE, FALSE); if (br_entry == NULL) { - info->callbacks->einfo (_("%P: can't build branch stub `%s'\n"), - stub_entry->root.string); + _bfd_error_handler (_("can't build branch stub `%s'"), + stub_entry->root.string); htab->stub_error = TRUE; return FALSE; } @@ -13271,7 +13270,7 @@ ppc64_elf_build_stubs (struct bfd_link_info *info, if (group != NULL) { htab->stub_error = TRUE; - info->callbacks->einfo (_("%P: stubs don't match calculated size\n")); + _bfd_error_handler (_("stubs don't match calculated size")); } if (htab->stub_error) @@ -14352,10 +14351,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, switch (r_type) { default: - info->callbacks->einfo - /* xgettext:c-format */ - (_("%P: %pB: unknown relocation type %d for `%pT'\n"), - input_bfd, (int) r_type, sym_name); + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: %s unsupported"), + input_bfd, ppc64_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -15711,8 +15709,8 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, + (p + 8 - htab->glink_eh_frame->contents)); if (val + 0x80000000 > 0xffffffff) { - info->callbacks->einfo - (_("%P: %s offset too large for .eh_frame sdata4 encoding"), + _bfd_error_handler + (_("%s offset too large for .eh_frame sdata4 encoding"), group->stub_sec->name); return FALSE; } @@ -15730,8 +15728,8 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, + (p + 8 - htab->glink_eh_frame->contents)); if (val + 0x80000000 > 0xffffffff) { - info->callbacks->einfo - (_("%P: %s offset too large for .eh_frame sdata4 encoding"), + _bfd_error_handler + (_("%s offset too large for .eh_frame sdata4 encoding"), htab->glink->name); return FALSE; } diff --git a/ld/ChangeLog b/ld/ChangeLog index 6ec4fafb389..8eeaf41d786 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2018-02-26 Alan Modra + + * testsuite/ld-powerpc/attr-gnu-12-21.d, + * testsuite/ld-powerpc/attr-gnu-4-12.d, + * testsuite/ld-powerpc/attr-gnu-4-13.d, + * testsuite/ld-powerpc/attr-gnu-4-21.d, + * testsuite/ld-powerpc/attr-gnu-4-23.d, + * testsuite/ld-powerpc/attr-gnu-4-31.d, + * testsuite/ld-powerpc/attr-gnu-4-32.d, + * testsuite/ld-powerpc/attr-gnu-8-23.d: Update. + 2018-02-21 Alan Modra * testsuite/ld-elf/group8b.d: Run test on ia64. Use xfail rather diff --git a/ld/testsuite/ld-powerpc/attr-gnu-12-21.d b/ld/testsuite/ld-powerpc/attr-gnu-12-21.d index ef14e35f8ef..d651d7aab02 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-12-21.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-12-21.d @@ -2,5 +2,5 @@ #source: attr-gnu-12-1.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses r3/r4 for small structure returns, .* uses memory +#warning: warning: .* uses r3/r4 for small structure returns, .* uses memory #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-12.d b/ld/testsuite/ld-powerpc/attr-gnu-4-12.d index b7ffba0ff15..9e5eb457852 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-12.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-12.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-2.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses hard float, .* uses soft float +#warning: warning: .* uses hard float, .* uses soft float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-13.d b/ld/testsuite/ld-powerpc/attr-gnu-4-13.d index 6bc3de4a55e..d69da1d4839 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-13.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-13.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-3.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses double-precision hard float, .* uses single-precision hard float +#warning: warning: .* uses double-precision hard float, .* uses single-precision hard float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-21.d b/ld/testsuite/ld-powerpc/attr-gnu-4-21.d index b38f24837be..65020cc23f6 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-21.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-21.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-1.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses hard float, .* uses soft float +#warning: warning: .* uses hard float, .* uses soft float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-23.d b/ld/testsuite/ld-powerpc/attr-gnu-4-23.d index f72c258d66a..cb22893716c 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-23.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-23.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-3.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses hard float, .* uses soft float +#warning: warning: .* uses hard float, .* uses soft float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-31.d b/ld/testsuite/ld-powerpc/attr-gnu-4-31.d index 8ee1874a105..1686f4e74a1 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-31.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-31.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-1.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses double-precision hard float, .* uses single-precision hard float +#warning: warning: .* uses double-precision hard float, .* uses single-precision hard float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-32.d b/ld/testsuite/ld-powerpc/attr-gnu-4-32.d index 924a3af0b17..aeca8f3ed67 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-32.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-32.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-2.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses hard float, .* uses soft float +#warning: warning: .* uses hard float, .* uses soft float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-8-23.d b/ld/testsuite/ld-powerpc/attr-gnu-8-23.d index b442884e721..35189567562 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-8-23.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-8-23.d @@ -2,5 +2,5 @@ #source: attr-gnu-8-3.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses AltiVec vector ABI, .* uses SPE vector ABI +#warning: warning: .* uses AltiVec vector ABI, .* uses SPE vector ABI #target: powerpc*-*-*