Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Alexander Richardson <Alexander.Richardson@cl.cam.ac.uk>
Cc: Binutils <binutils@sourceware.org>, gdb-patches@sourceware.org
Subject: Re: [PATCH] GDB: Fix detection of ELF support when configuring with -Werror
Date: Thu, 12 Nov 2020 09:25:28 -0500	[thread overview]
Message-ID: <b6beeaf8-252f-04cc-7ace-04fc5b9a2185@simark.ca> (raw)
In-Reply-To: <CAEeofcjsWq7EVmRD8_vAm127X4Tj3MQF0c4xLj+HhU3ziSi5fg@mail.gmail.com>


On 2020-11-12 4:25 a.m., Alexander Richardson wrote:
> On Wed, 11 Nov 2020 at 20:48, Simon Marchi <simark@simark.ca> 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 <stdlib.h>
>>> +        #include <string.h>
>>>          #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 <stdlib.h>
>>> +        #include <string.h>
>>>          #include "bfd.h"
>>>          #include "elf-bfd.h"
>>>  int
>>> @@ -16858,6 +16859,7 @@ else
>>>    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>>>  /* end confdefs.h.  */
>>>  #include <stdlib.h>
>>> +        #include <string.h>
>>>          #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

  parent reply	other threads:[~2020-11-12 14:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  9:20 Alex Richardson via Gdb-patches
2020-11-11 20:48 ` Simon Marchi
2020-11-12  9:25   ` Alexander Richardson via Gdb-patches
2020-11-12 14:23     ` Tom Tromey
2020-11-12 14:25     ` Simon Marchi [this message]
2020-11-13 12:09       ` Nick Clifton via Gdb-patches
2020-11-13 13:46         ` Simon Marchi
2020-11-20  1:12           ` Alexander Richardson via Gdb-patches
2020-11-20 15:54             ` Tom Tromey
2020-11-28 16:50               ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6beeaf8-252f-04cc-7ace-04fc5b9a2185@simark.ca \
    --to=simark@simark.ca \
    --cc=Alexander.Richardson@cl.cam.ac.uk \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox