GDB: Fix detection of ELF support when configuring with -Werror=implicit-function...
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Sat, 28 Nov 2020 16:45:06 +0000 (11:45 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sat, 28 Nov 2020 16:45:16 +0000 (11:45 -0500)
I am 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 1ff6de031241 ("bfd, ld: add CTF section linking"), bfd.h depends
on strncmp() being present, so configuring with
-Werror=implicit-function-declaration 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/ChangeLog:

* acincludde.m4 (GDB_AC_CHECK_BFD): Include string.h in the test
program.

Change-Id: Iec5e21d454c2a544c44d65e23cfde552c424c18e

gdb/ChangeLog
gdb/acinclude.m4
gdb/configure

index e9beaaba6325e9f2938df34d18467e110bbbdc66..acffdefc8cf1fdb77c7cdabca66ed89d48501495 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-28  Alex Richardson  <Alexander.Richardson@cl.cam.ac.uk>
+
+       * acincludde.m4 (GDB_AC_CHECK_BFD): Include string.h in the test
+       program.
+
 2020-11-27  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * printcmd.c (skip_over_slash_fmt): Reorder code to ensure in_fmt
index 64574e2631428b088beb0ec8f9805f6c9db58abd..68520d6d9381807cbfe18c118321e8c5e8a7ef69 100644 (file)
@@ -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;]
index a3e73b431c4345e3490ff90aa7cb1a1d77d7ffc4..24e6fbc8fa7b7af2471b66301c3c5350af0374d1 100755 (executable)
@@ -17236,6 +17236,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
@@ -17349,6 +17350,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