Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Check return value of bfd_init
@ 2018-10-25 15:03 Tom Tromey
  2018-10-25 15:25 ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2018-10-25 15:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Alan recently added a way for BFD library users to check whether they
were in fact loading a compatible version of BFD:

https://sourceware.org/ml/binutils/2018-10/msg00198.html

It seemed reasonable to me that gdb should do this check as well, in
case someone is dynamically linking against BFD.  Tested by rebuilding
and then starting the resulting gdb.

gdb/ChangeLog
2018-10-25  Tom Tromey  <tom@tromey.com>

	* main.c (captured_main_1): Check return value of bfd_init.
---
 gdb/ChangeLog | 4 ++++
 gdb/main.c    | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 61dc039d4fe..a90c2978185 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-25  Tom Tromey  <tom@tromey.com>
+
+	* main.c (captured_main_1): Check return value of bfd_init.
+
 2018-10-25  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* python/py-function.c (convert_values_to_python): Return
diff --git a/gdb/main.c b/gdb/main.c
index 8709357e924..96def3080eb 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -506,7 +506,8 @@ captured_main_1 (struct captured_main_args *context)
   textdomain (PACKAGE);
 #endif
 
-  bfd_init ();
+  if (bfd_init () != BFD_INIT_MAGIC)
+    error (_("fatal error: libbfd ABI mismatch"));
   notice_open_fds ();
 
   saved_command_line = (char *) xstrdup ("");
-- 
2.17.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-26 19:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25 15:03 [PATCH] Check return value of bfd_init Tom Tromey
2018-10-25 15:25 ` Simon Marchi
     [not found]   ` <87efcehwlx.fsf@tromey.com>
2018-10-26 15:41     ` Tom Tromey
2018-10-26 18:31       ` Simon Marchi
2018-10-26 19:48         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox