diff options
-rw-r--r-- | bfd/ChangeLog | 22 | ||||
-rw-r--r-- | bfd/bfd-in.h | 1 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 7 | ||||
-rw-r--r-- | bfd/bfd.c | 63 | ||||
-rw-r--r-- | bfd/coffgen.c | 3 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 2 | ||||
-rw-r--r-- | bfd/elf64-mmix.c | 4 | ||||
-rw-r--r-- | bfd/elfxx-target.h | 2 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 4 | ||||
-rw-r--r-- | bfd/libbfd.h | 4 | ||||
-rw-r--r-- | ld/ChangeLog | 4 | ||||
-rw-r--r-- | ld/ldlang.c | 3 |
12 files changed, 57 insertions, 62 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7944561..37333a3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,25 @@ +2016-09-30 Alan Modra <amodra@gmail.com> + + * bfd-in.h: Include stdarg.h. + * bfd.c (bfd_error_handler_type): Make like vprintf. + (_bfd_error_internal): Rename from _bfd_error_handler. Make static. + (error_handler_internal): New function, split out from.. + (_bfd_default_error_handler): ..here. Rename to _bfd_error_handler. + (bfd_set_error_handler): Update. + (bfd_get_error_handler, bfd_get_assert_handler): Delete. + (_bfd_assert_handler): Make static. + * coffgen.c (null_error_handler): Update params. + * elf-bfd.h (struct elf_backend_data <link_order_error_handler>): + Don't use bfd_error_handler_type. + * elf64-mmix.c (mmix_dump_bpo_gregs): Likewise. + * elfxx-target.h (elf_backend_link_order_error_handler): Default + to _bfd_error_handler. + * libbfd-in.h (_bfd_default_error_handler): Don't declare. + (bfd_assert_handler_type): Likewise. + (_bfd_error_handler): Update. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2016-09-28 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> PR ld/20636 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index fa3da83..4b3bcfd 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -34,6 +34,7 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" +#include <stdarg.h> #include <sys/stat.h> #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 00eb857..1dc1c74 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -41,6 +41,7 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" +#include <stdarg.h> #include <sys/stat.h> #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) @@ -6928,14 +6929,12 @@ const char *bfd_errmsg (bfd_error_type error_tag); void bfd_perror (const char *message); -typedef void (*bfd_error_handler_type) (const char *, ...); +typedef void (*bfd_error_handler_type) (const char *, va_list); bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); void bfd_set_error_program_name (const char *); -bfd_error_handler_type bfd_get_error_handler (void); - typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, const char *bfd_version, @@ -6944,8 +6943,6 @@ typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type); -bfd_assert_handler_type bfd_get_assert_handler (void); - long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); long bfd_canonicalize_reloc @@ -598,11 +598,11 @@ SUBSECTION problem. They call a BFD error handler function. This function may be overridden by the program. - The BFD error handler acts like printf. + The BFD error handler acts like vprintf. CODE_FRAGMENT . -.typedef void (*bfd_error_handler_type) (const char *, ...); +.typedef void (*bfd_error_handler_type) (const char *, va_list); . */ @@ -634,10 +634,9 @@ static const char *_bfd_error_program_name; integer_for_the_%d); */ -void -_bfd_default_error_handler (const char *fmt, ...) +static void +error_handler_internal (const char *fmt, va_list ap) { - va_list ap; char *bufp; const char *new_fmt, *p; size_t avail = 1000; @@ -651,7 +650,6 @@ _bfd_default_error_handler (const char *fmt, ...) else fprintf (stderr, "BFD: "); - va_start (ap, fmt); new_fmt = fmt; bufp = buf; @@ -782,7 +780,6 @@ _bfd_default_error_handler (const char *fmt, ...) } vfprintf (stderr, new_fmt, ap); - va_end (ap); /* On AIX, putc is implemented as a macro that triggers a -Wunused-value warning, so use the fputc function to avoid it. */ @@ -796,7 +793,17 @@ _bfd_default_error_handler (const char *fmt, ...) function pointer permits a program linked against BFD to intercept the messages and deal with them itself. */ -bfd_error_handler_type _bfd_error_handler = _bfd_default_error_handler; +static bfd_error_handler_type _bfd_error_internal = error_handler_internal; + +void +_bfd_error_handler (const char *fmt, ...) +{ + va_list ap; + + va_start (ap, fmt); + _bfd_error_internal (fmt, ap); + va_end (ap); +} /* FUNCTION @@ -815,8 +822,8 @@ bfd_set_error_handler (bfd_error_handler_type pnew) { bfd_error_handler_type pold; - pold = _bfd_error_handler; - _bfd_error_handler = pnew; + pold = _bfd_error_internal; + _bfd_error_internal = pnew; return pold; } @@ -841,23 +848,6 @@ bfd_set_error_program_name (const char *name) } /* -FUNCTION - bfd_get_error_handler - -SYNOPSIS - bfd_error_handler_type bfd_get_error_handler (void); - -DESCRIPTION - Return the BFD error handler function. -*/ - -bfd_error_handler_type -bfd_get_error_handler (void) -{ - return _bfd_error_handler; -} - -/* SUBSECTION BFD assert handler @@ -898,7 +888,7 @@ _bfd_default_assert_handler (const char *bfd_formatmsg, internal BFD error. We use a non-variadic type to simplify passing on parameters to other functions, e.g. _bfd_error_handler. */ -bfd_assert_handler_type _bfd_assert_handler = _bfd_default_assert_handler; +static bfd_assert_handler_type _bfd_assert_handler = _bfd_default_assert_handler; /* FUNCTION @@ -921,23 +911,6 @@ bfd_set_assert_handler (bfd_assert_handler_type pnew) _bfd_assert_handler = pnew; return pold; } - -/* -FUNCTION - bfd_get_assert_handler - -SYNOPSIS - bfd_assert_handler_type bfd_get_assert_handler (void); - -DESCRIPTION - Return the BFD assert handler function. -*/ - -bfd_assert_handler_type -bfd_get_assert_handler (void) -{ - return _bfd_assert_handler; -} /* INODE diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 75512fb..b9b8860 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1218,7 +1218,8 @@ coff_write_native_symbol (bfd *abfd, } static void -null_error_handler (const char * fmt ATTRIBUTE_UNUSED, ...) +null_error_handler (const char *fmt ATTRIBUTE_UNUSED, + va_list ap ATTRIBUTE_UNUSED) { } diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 6bebbbe..7f78b1d 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1326,7 +1326,7 @@ struct elf_backend_data Elf_Internal_Shdr *osection); /* Used to handle bad SHF_LINK_ORDER input. */ - bfd_error_handler_type link_order_error_handler; + void (*link_order_error_handler) (const char *, ...); /* Name of the PLT relocation section. */ const char *relplt_name; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 2038813..9c56f7c 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -172,7 +172,7 @@ extern void mmix_elf_symbol_processing (bfd *, asymbol *); /* Only intended to be called from a debugger. */ extern void mmix_dump_bpo_gregs - (struct bfd_link_info *, bfd_error_handler_type); + (struct bfd_link_info *, void (*) (const char *, ...)); static void mmix_set_relaxable_size (bfd *, asection *, void *); @@ -2485,7 +2485,7 @@ bpo_reloc_request_sort_fn (const void * p1, const void * p2) void mmix_dump_bpo_gregs (struct bfd_link_info *link_info, - bfd_error_handler_type pf) + void (*pf) (const char *fmt, ...)) { bfd *bpo_greg_owner; asection *bpo_gregs_section; diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index ba13012..6bab686 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -660,7 +660,7 @@ #endif #ifndef elf_backend_link_order_error_handler -#define elf_backend_link_order_error_handler _bfd_default_error_handler +#define elf_backend_link_order_error_handler _bfd_error_handler #endif #ifndef elf_backend_common_definition diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index cde3aad..f27adc9 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -109,9 +109,7 @@ extern void *bfd_realloc2 extern void *bfd_zmalloc2 (bfd_size_type, bfd_size_type); -extern void _bfd_default_error_handler (const char *s, ...); -extern bfd_error_handler_type _bfd_error_handler; -extern bfd_assert_handler_type _bfd_assert_handler; +extern void _bfd_error_handler (const char *s, ...); /* These routines allocate and free things on the BFD's objalloc. */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 1eb988f..99ff2d3 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -114,9 +114,7 @@ extern void *bfd_realloc2 extern void *bfd_zmalloc2 (bfd_size_type, bfd_size_type); -extern void _bfd_default_error_handler (const char *s, ...); -extern bfd_error_handler_type _bfd_error_handler; -extern bfd_assert_handler_type _bfd_assert_handler; +extern void _bfd_error_handler (const char *s, ...); /* These routines allocate and free things on the BFD's objalloc. */ diff --git a/ld/ChangeLog b/ld/ChangeLog index c5367a3..3d08e3c 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2016-09-30 Alan Modra <amodra@gmail.com> + + * ldlang.c (ignore_bfd_errors): Update params. + 2016-09-29 H.J. Lu <hongjiu.lu@intel.com> PR ld/20528 diff --git a/ld/ldlang.c b/ld/ldlang.c index 07c2182..0a38d0b 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -5984,7 +5984,8 @@ lang_end (void) BFD. */ static void -ignore_bfd_errors (const char *s ATTRIBUTE_UNUSED, ...) +ignore_bfd_errors (const char *fmt ATTRIBUTE_UNUSED, + va_list ap ATTRIBUTE_UNUSED) { /* Don't do anything. */ } |