[PATCH] GDB: Fix detection of ELF support when configuring with -Werror

Alexander Richardson Alexander.Richardson@cl.cam.ac.uk
Fri Nov 20 01:12:43 GMT 2020


On Fri, 13 Nov 2020 at 13:46, Simon Marchi <simark@simark.ca> wrote:
>
>
> On 2020-11-13 7:09 a.m., Nick Clifton wrote:
> > 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?
> >
> > Essentially this is because elf-bfd.h is internal to the binutils
> > sources, and not expected to be used elsewhere.  So any code that
> > includes it is also expected to include the sysdep.h header which
> > does then include the needed system headers.
> >
> > The idea is that all of the configuration time decisions about which
> > system headers to include are confined to one file - sysdep.h - rather
> > than having to be copied into all header files.
> >
> > Cheers
> >   Nick
> >
> >
>
> Ah ok I remember this, we started discussing this in:
>
> https://sourceware.org/pipermail/gdb-patches/2020-September/172041.html
>
> In an ideal world, GDB would stop using BFD's internal functions.  But
> for this, BFD would need to expose some ELF-specific bits, such as
> program headers.  I don't know if this is against BFD's design
> principles to abstract things across various executable formats.
>
> I think Alexander's patch is fine, I don't think the complexity of the
> patch linked above is necessary.  Are there even any systems today that
> GDB supports for which strncmp isn't found in string.h?
>
> Alexander, may I ask what particular configuration you are using?  It
> would be good to document it in the commit log.
>
Hi Simon,

I was configuring GDB with -Werror=implicit-function-definition in
CFLAGS and the --disable-werror configure argument.
I've dropped that flag from my build scripts for now, but I would like
to add it again if this patch is accepted.

Thanks,
Alex


More information about the Binutils mailing list