[binutils-gdb] Make _bfd_error_handler available outside libbfd

Alan Modra amodra@sourceware.org
Fri Jun 1 03:51:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=030157d8a65afcc6292a4d3d183b816ed2ff7c57

commit 030157d8a65afcc6292a4d3d183b816ed2ff7c57
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 1 11:00:46 2018 +0930

    Make _bfd_error_handler available outside libbfd
    
    Needed when building libopcodes.so.
    
    bfd/
    	* bfd.c (_bfd_error_handler): Arrange for this function to be
    	declared in bfd-in2.h.
    	* libbfd-in.h (_bfd_error_handler): Don't declare.
    	* libbfd.h: Regenerate.
    	* bfd-in2.h: Regenerate.
    opcodes/
    	* sysdep.h (_bfd_error_handler): Don't declare.
    	* msp430-decode.opc: Include bfd.h.  Don't include ansidecl.h here.
    	* rl78-decode.opc: Likewise.
    	* msp430-decode.c: Regenerate.
    	* rl78-decode.c: Regenerate.

Diff:
---
 bfd/ChangeLog             |  8 ++++++++
 bfd/bfd-in2.h             |  2 ++
 bfd/bfd.c                 | 28 ++++++++++++++++++++--------
 bfd/libbfd-in.h           |  3 ---
 bfd/libbfd.h              |  3 ---
 opcodes/ChangeLog         |  8 ++++++++
 opcodes/msp430-decode.c   |  2 +-
 opcodes/msp430-decode.opc |  2 +-
 opcodes/rl78-decode.c     |  2 +-
 opcodes/rl78-decode.opc   |  2 +-
 opcodes/sysdep.h          |  1 -
 11 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 829305e..afc4d4f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-01  Alan Modra  <amodra@gmail.com>
+
+	* bfd.c (_bfd_error_handler): Arrange for this function to be
+	declared in bfd-in2.h.
+	* libbfd-in.h (_bfd_error_handler): Don't declare.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Regenerate.
+
 2018-05-30  Amaan Cheval <amaan.cheval@gmail.com>
 
 	* config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 9d643f3..ef62f31 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7111,6 +7111,8 @@ void bfd_perror (const char *message);
 
 typedef void (*bfd_error_handler_type) (const char *, va_list);
 
+void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
+
 bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
 
 void bfd_set_error_program_name (const char *);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 3bf56a6..09c817d 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1087,14 +1087,6 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
   return arg_count;
 }
 
-/* This is the default routine to handle BFD error messages.
-   Like fprintf (stderr, ...), but also handles some extra format specifiers.
-
-   %pA section name from section.  For group components, prints group name too.
-   %pB file name from bfd.  For archive components, prints archive too.
-
-   Beware: Only supports a maximum of 9 format arguments.  */
-
 static void
 error_handler_internal (const char *fmt, va_list ap)
 {
@@ -1156,6 +1148,26 @@ error_handler_internal (const char *fmt, va_list ap)
 
 static bfd_error_handler_type _bfd_error_internal = error_handler_internal;
 
+/*
+FUNCTION
+	_bfd_error_handler
+
+SYNOPSIS
+	void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
+
+DESCRIPTION
+	This is the default routine to handle BFD error messages.
+	Like fprintf (stderr, ...), but also handles some extra format
+	specifiers.
+
+	%pA section name from section.  For group components, prints
+	group name too.
+	%pB file name from bfd.  For archive components, prints
+	archive too.
+
+	Beware: Only supports a maximum of 9 format arguments.
+*/
+
 void
 _bfd_error_handler (const char *fmt, ...)
 {
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 9796f2d..3c55adf 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -123,9 +123,6 @@ extern void *bfd_realloc2
 extern void *bfd_zmalloc2
   (bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN;
 
-extern void _bfd_error_handler (const char *s, ...)
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_HIDDEN;
-
 /* These routines allocate and free things on the BFD's objalloc.  */
 
 extern void *bfd_alloc2
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index f357e0e..12b1a96 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -128,9 +128,6 @@ extern void *bfd_realloc2
 extern void *bfd_zmalloc2
   (bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN;
 
-extern void _bfd_error_handler (const char *s, ...)
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_HIDDEN;
-
 /* These routines allocate and free things on the BFD's objalloc.  */
 
 extern void *bfd_alloc2
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 005ca93..725bf15 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-01  Alan Modra  <amodra@gmail.com>
+
+	* sysdep.h (_bfd_error_handler): Don't declare.
+	* msp430-decode.opc: Include bfd.h.  Don't include ansidecl.h here.
+	* rl78-decode.opc: Likewise.
+	* msp430-decode.c: Regenerate.
+	* rl78-decode.c: Regenerate.
+
 2018-05-30  Amit Pawar <Amit.Pawar@amd.com>
 
 	* i386-gen.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
diff --git a/opcodes/msp430-decode.c b/opcodes/msp430-decode.c
index eb10116..68d9073 100644
--- a/opcodes/msp430-decode.c
+++ b/opcodes/msp430-decode.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "ansidecl.h"
+#include "bfd.h"
 #include "opintl.h"
 #include "opcode/msp430-decode.h"
 
diff --git a/opcodes/msp430-decode.opc b/opcodes/msp430-decode.opc
index 8cdae5a..71ff762 100644
--- a/opcodes/msp430-decode.opc
+++ b/opcodes/msp430-decode.opc
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "ansidecl.h"
+#include "bfd.h"
 #include "opintl.h"
 #include "opcode/msp430-decode.h"
 
diff --git a/opcodes/rl78-decode.c b/opcodes/rl78-decode.c
index 18d0076..3edc8ac 100644
--- a/opcodes/rl78-decode.c
+++ b/opcodes/rl78-decode.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "ansidecl.h"
+#include "bfd.h"
 #include "opintl.h"
 #include "opcode/rl78.h"
 
diff --git a/opcodes/rl78-decode.opc b/opcodes/rl78-decode.opc
index 49e9e69..444ced2 100644
--- a/opcodes/rl78-decode.opc
+++ b/opcodes/rl78-decode.opc
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "ansidecl.h"
+#include "bfd.h"
 #include "opintl.h"
 #include "opcode/rl78.h"
 
diff --git a/opcodes/sysdep.h b/opcodes/sysdep.h
index 20f5828..8e5e6af 100644
--- a/opcodes/sysdep.h
+++ b/opcodes/sysdep.h
@@ -57,7 +57,6 @@ extern char *stpcpy (char *__dest, const char *__src);
 #endif
 
 #define opcodes_error_handler _bfd_error_handler
-extern void _bfd_error_handler (const char *, ...) ATTRIBUTE_PRINTF_1;
 
 /* Use sigsetjmp/siglongjmp without saving the signal mask if possible.
    It is faster than setjmp/longjmp on systems where the signal mask is



More information about the Binutils-cvs mailing list