From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id FBA4NNxFrV/LTQAAWB0awg (envelope-from ) for ; Thu, 12 Nov 2020 09:25:32 -0500 Received: by simark.ca (Postfix, from userid 112) id CEEF71F08B; Thu, 12 Nov 2020 09:25:32 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8388F1E552 for ; Thu, 12 Nov 2020 09:25:32 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E9BA03A4B813; Thu, 12 Nov 2020 14:25:31 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 86DDB3858007; Thu, 12 Nov 2020 14:25:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 86DDB3858007 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 013031E552; Thu, 12 Nov 2020 09:25:28 -0500 (EST) Subject: Re: [PATCH] GDB: Fix detection of ELF support when configuring with -Werror To: Alexander Richardson References: <20201111092021.5428-1-Alexander.Richardson@cl.cam.ac.uk> <52dc77e4-ff34-be60-13af-f580d3cf77e7@simark.ca> From: Simon Marchi Message-ID: Date: Thu, 12 Nov 2020 09:25:28 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Binutils , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2020-11-12 4:25 a.m., Alexander Richardson wrote: > On Wed, 11 Nov 2020 at 20:48, Simon Marchi wrote: >> >> On 2020-11-11 4:20 a.m., Alex Richardson via Gdb-patches wrote: >>> I was getting "I'm sorry, Dave, I can't do that. Symbol format `elf64-littleriscv' unknown." >>> errors after updating from GDB 8.3 to 10. Bisecting showed that since >>> commit 1ff6de031241c59d0ff9fa01d3c0a4049b0e97c9, bfd.h depends on strncmp() >>> being present, so configuring with -Werror results in the check for ELF >>> support in BFD failing: >>> .../gdb/gdb/../bfd/elf-bfd.h: In function 'bfd_section_is_ctf': >>> .../gdb/gdb/../bfd/elf-bfd.h:3086:10: error: implicit declaration of function 'strncmp' [-Werror=implicit-function-declaration] >>> return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.'); >>> --- >>> gdb/acinclude.m4 | 1 + >>> gdb/configure | 2 ++ >>> 2 files changed, 3 insertions(+) >>> >>> diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 >>> index 64574e26314..68520d6d938 100644 >>> --- a/gdb/acinclude.m4 >>> +++ b/gdb/acinclude.m4 >>> @@ -266,6 +266,7 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ >>> [AC_LINK_IFELSE( >>> [AC_LANG_PROGRAM( >>> [#include >>> + #include >>> #include "bfd.h" >>> #include "$4"], >>> [return $3;] >>> diff --git a/gdb/configure b/gdb/configure >>> index 4a03cd9c3ec..ddbeefe426e 100755 >>> --- a/gdb/configure >>> +++ b/gdb/configure >>> @@ -16745,6 +16745,7 @@ else >>> cat confdefs.h - <<_ACEOF >conftest.$ac_ext >>> /* end confdefs.h. */ >>> #include >>> + #include >>> #include "bfd.h" >>> #include "elf-bfd.h" >>> int >>> @@ -16858,6 +16859,7 @@ else >>> cat confdefs.h - <<_ACEOF >conftest.$ac_ext >>> /* end confdefs.h. */ >>> #include >>> + #include >>> #include "bfd.h" >>> #include "mach-o.h" >>> int >>> -- >>> 2.29.1 >>> >> >> Since elf-bfd.h uses strncmp, I think it should include string.h. Is there a good reason not to do that? >> > > Hi Simon, > > that's what I originally planned, but it seems like elf-bfd.h (and the > headers it includes) don't include any system headers. Since I'm not > familiar with any of this code I assumed this was intentional. > > Alex > Hi binutils@, Could you check the discussion above? Is there a reason elf-bfd.h doesn't include the header file it needs to use the functions it uses? Simon