[PATCH] Include string.h in elf-bfd.h

Saagar Jha saagar@saagarjha.com
Tue Sep 8 22:23:16 GMT 2020


Hi Nick,

This is the GDB configure test for ELF support: https://sourceware.org/git?p=binutils-gdb.git;a=blob;f=gdb/configure;h=e7811e807a6b42db1b28f46bdf43afb321f0ae05;hb=HEAD#l16820. It doesn’t include “sysdep.h” or <string(s).h> before “elf-bfd.h”, so it causes that check to fail and GDB to build without ELF support. I changed the header itself just in case something else was also including it without including other appropriate headers, but if it’s just this instance we can just include the right header in the test. Would that be “sysdep.h”?

Regards,
Saagar

> On Sep 7, 2020, at 03:04, Nick Clifton <nickc@redhat.com> wrote:
> 
> Hi Saagar,
> 
>> elf-bfd.h uses functions from <string.h> but doesn’t include it, which causes problems for a configure test that uses it when compiled with a compiler that is picky about missing prototypes (such as macOS’s as of recently). This patch adds the missing include.
> 
> Which configure test(s) are causing this problem ?
> 
> The inclusion of <string.h> is actually handled by "sysdep.h", which
> handles the correct selection of <string.h> vs <strings.h>.  No normal code
> should be including elf-bfd.h without previously including that header.
> 
> Configure tests are special, since they are hand crafted, but to me this
> sounds like a bug with the configure test, not the elf-bfd.h header.
> 
> Cheers
>  Nick
> 
> 



More information about the Binutils mailing list