From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id C0GwHixOrF85NgAAWB0awg (envelope-from ) for ; Wed, 11 Nov 2020 15:48:44 -0500 Received: by simark.ca (Postfix, from userid 112) id 705DB1F08B; Wed, 11 Nov 2020 15:48:44 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [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 D0E7C1E965 for ; Wed, 11 Nov 2020 15:48:43 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 899D4385043A; Wed, 11 Nov 2020 20:48:43 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5675C3857828 for ; Wed, 11 Nov 2020 20:48:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5675C3857828 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 [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (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 CA1241E58F; Wed, 11 Nov 2020 15:48:40 -0500 (EST) Subject: Re: [PATCH] GDB: Fix detection of ELF support when configuring with -Werror To: Alex Richardson , gdb-patches@sourceware.org References: <20201111092021.5428-1-Alexander.Richardson@cl.cam.ac.uk> From: Simon Marchi Message-ID: <52dc77e4-ff34-be60-13af-f580d3cf77e7@simark.ca> Date: Wed, 11 Nov 2020 15:48:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201111092021.5428-1-Alexander.Richardson@cl.cam.ac.uk> Content-Type: text/plain; charset=utf-8 Content-Language: tl 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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? Simon