From patchwork Thu Oct 25 15:03:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 29887 Received: (qmail 27079 invoked by alias); 25 Oct 2018 15:03:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27065 invoked by uid 89); 25 Oct 2018 15:03:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=PACKAGE, Hx-languages-length:1354, sk:capture X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.102) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Oct 2018 15:03:46 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 8F5AD9C0B for ; Thu, 25 Oct 2018 10:03:45 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id FhAngQws1PvAdFhAngDCCM; Thu, 25 Oct 2018 10:03:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=l6BQTV45cWhknEzelnqjqZtveLxcD2ntaDstEE7kz+8=; b=yeHfNfAPXMC93h2/ho6PwAS7HH KhxZJVfYCFFaXH8ZAMtc7PFVjIiVJZYkGkMVOAVRNSGkpG3vIw1n0IiBBT6rrWgqf3aqENO3kug7I bYsqZF8Sb8hskAFRu24z3RLBh; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:44910 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gFhAn-002UKy-9Z; Thu, 25 Oct 2018 10:03:45 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Check return value of bfd_init Date: Thu, 25 Oct 2018 09:03:40 -0600 Message-Id: <20181025150340.28844-1-tom@tromey.com> 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 * 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 + + * main.c (captured_main_1): Check return value of bfd_init. + 2018-10-25 Andrew Burgess * 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 ("");