From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QAf3FqX/rF96RgAAWB0awg (envelope-from ) for ; Thu, 12 Nov 2020 04:25:57 -0500 Received: by simark.ca (Postfix, from userid 112) id 5C0C21F08B; Thu, 12 Nov 2020 04:25:57 -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.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 104401E552 for ; Thu, 12 Nov 2020 04:25:57 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6BB183858028; Thu, 12 Nov 2020 09:25:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BB183858028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605173156; bh=/Uves0EFJ3Enfe05KJINqom1A/QeT4C/p+sIEgQgdOY=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=w/qNnteeBBbzUed6oi80QL0/yi2MaOwYcInBqF+/sM+zV1qJsjd0z/n15KoB4vc7w XR6Ss86AxWs9pLXyKy8VjPMCSm5G2HYoklEMiQPBt8tCqE979jS9QB4ejpmpqaZDe7 qCbjBY0YtWujuIpVvsRXg2Fu45DHYUDpeyCJO5Lk= Received: from ppsw-41.csi.cam.ac.uk (ppsw-41.csi.cam.ac.uk [131.111.8.141]) by sourceware.org (Postfix) with ESMTPS id C5DD139F6E4B for ; Thu, 12 Nov 2020 09:25:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5DD139F6E4B X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from mail-ej1-f50.google.com ([209.85.218.50]:44029) by ppsw-41.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (PLAIN:alr48) (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1kd8rS-000sja-Pw (Exim 4.92.3) for gdb-patches@sourceware.org (return-path ); Thu, 12 Nov 2020 09:25:51 +0000 Received: by mail-ej1-f50.google.com with SMTP id me8so6688089ejb.10 for ; Thu, 12 Nov 2020 01:25:46 -0800 (PST) X-Gm-Message-State: AOAM531M6yssWimrD9us1PSVTsjncGoiOrmRqx291b3hr7THdsOzReM5 MPMpo6k4wXGVBzrE8xJIphnp2/jVvjjQrieF4lY= X-Google-Smtp-Source: ABdhPJwceQA5sidPg0mz7oQYNFaITbPQDy9pXCDxcsMGI+LHfu7uk6tx916lUkSfPuCiI4Vm6wyb6LidKFPj6X0icHI= X-Received: by 2002:a17:906:4e56:: with SMTP id g22mr29406827ejw.49.1605173145719; Thu, 12 Nov 2020 01:25:45 -0800 (PST) MIME-Version: 1.0 References: <20201111092021.5428-1-Alexander.Richardson@cl.cam.ac.uk> <52dc77e4-ff34-be60-13af-f580d3cf77e7@simark.ca> In-Reply-To: <52dc77e4-ff34-be60-13af-f580d3cf77e7@simark.ca> Date: Thu, 12 Nov 2020 09:25:29 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] GDB: Fix detection of ELF support when configuring with -Werror To: simark@simark.ca Content-Type: text/plain; charset="UTF-8" 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: , From: Alexander Richardson via Gdb-patches Reply-To: Alexander Richardson Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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