Rewrite bfd error handler

This steals _doprnt from libiberty, extended to handle %A and %B.
Which lets us do away with the current horrible %A and %B handling
that requires all %A and %B arguments to be passed first, rather than
in the natural order.

	* bfd.c (PRINT_TYPE): Define.
	(_doprnt): New function.
	(error_handler_internal): Use _doprnt.
	* coff-arm.c: Put %A and %B arguments to _bfd_error_handler
	calls in their natural order, throughout file.
	* coff-mcore.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-tic80.c: Likewise.
	* cofflink.c: Likewise.
	* elf-s390-common.c: Likewise.
	* elf.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-msp430.c: Likewise.
	* elf32-spu.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
This commit is contained in:
Alan Modra 2017-04-13 10:58:40 +09:30
parent 10463f39c7
commit c08bb8dd9b
21 changed files with 367 additions and 277 deletions

View file

@ -466,10 +466,10 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
{
_bfd_error_handler
/* xgettext:c-format */
(_("Register %%g%d used incompatibly: %s in %B, previously %s in %B"),
abfd, p->abfd, (int) sym->st_value,
**namep ? *namep : "#scratch",
*p->name ? p->name : "#scratch");
(_("Register %%g%d used incompatibly: %s in %B,"
" previously %s in %B"),
(int) sym->st_value, **namep ? *namep : "#scratch", abfd,
*p->name ? p->name : "#scratch", p->abfd);
return FALSE;
}
@ -490,8 +490,9 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
type = 0;
_bfd_error_handler
/* xgettext:c-format */
(_("Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"),
abfd, p->abfd, *namep, stt_types[type]);
(_("Symbol `%s' has differing types: REGISTER in %B,"
" previously %s in %B"),
*namep, abfd, stt_types[type], p->abfd);
return FALSE;
}
@ -536,8 +537,9 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
type = 0;
_bfd_error_handler
/* xgettext:c-format */
(_("Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"),
abfd, p->abfd, *namep, stt_types[type]);
(_("Symbol `%s' has differing types: %s in %B,"
" previously REGISTER in %B"),
*namep, stt_types[type], abfd, p->abfd);
return FALSE;
}
}