Add workaround from gdbserver's gdb_proc_service.h to GDB
authorGary Benson <gbenson@redhat.com>
Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)
committerGary Benson <gbenson@redhat.com>
Mon, 1 Oct 2018 09:37:39 +0000 (10:37 +0100)
This commit adds a workaround from gdbserver's gdb_proc_service.h
to GDB's.  It doesn't seem to have been needed on any glibc as far
back as 2001, but it's possibly required for other C libraries so
I've retained it.

gdb/ChangeLog:

* configure.ac: Check if sys/procfs.h defines elf_fpregset_t.
(AC_CHECK_HEADERS): Check for linux/elf.h.
* configure, config.in: Rebuild.
* gdb_proc_service.h: Include linux/elf.h if sys/procfs.h
doesn't define elf_fpregset_t.

gdb/ChangeLog
gdb/config.in
gdb/configure
gdb/configure.ac
gdb/gdb_proc_service.h

index 01ae3315de86de5a1aa8980e1580a7482a4cdb74..698c9b7b677d5cef4737e3395ac5e602f3e8d67b 100644 (file)
@@ -1,3 +1,11 @@
+2018-10-01  Gary Benson <gbenson@redhat.com>
+
+       * configure.ac: Check if sys/procfs.h defines elf_fpregset_t.
+       (AC_CHECK_HEADERS): Check for linux/elf.h.
+       * configure, config.in: Rebuild.
+       * gdb_proc_service.h: Include linux/elf.h if sys/procfs.h
+       doesn't define elf_fpregset_t.
+
 2018-10-01  Gary Benson <gbenson@redhat.com>
 
        * gdb_proc_service.h: Whitespace change.
index 01acda124b940b3802b993da8c1675ecfcd98483..fc7c85923c86525f56f54dfc5077bf60849db108 100644 (file)
 /* Define if ELF support should be included. */
 #undef HAVE_ELF
 
+/* Define if <sys/procfs.h> has elf_fpregset_t. */
+#undef HAVE_ELF_FPREGSET_T
+
 /* Define to 1 if you have the <elf_hp.h> header file. */
 #undef HAVE_ELF_HP_H
 
 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
 #undef HAVE_LIBUNWIND_IA64_H
 
+/* Define to 1 if you have the <linux/elf.h> header file. */
+#undef HAVE_LINUX_ELF_H
+
 /* Define to 1 if you have the <linux/perf_event.h> header file. */
 #undef HAVE_LINUX_PERF_EVENT_H
 
index a5d6e747e783cae5e5895b9478727f1ea29efc22..4a725f666d36f6d64504c78efde7bb9190f04bbd 100755 (executable)
@@ -12165,7 +12165,7 @@ fi
 
 # elf_hp.h is for HP/UX 64-bit shared library support.
 for ac_header in nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
-                  thread_db.h \
+                  thread_db.h linux/elf.h \
                  sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
                  sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
                  sys/reg.h sys/debugreg.h sys/select.h \
@@ -14636,6 +14636,43 @@ $as_echo "#define HAVE_PSADDR_T 1" >>confdefs.h
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_psaddr_t" >&5
 $as_echo "$bfd_cv_have_sys_procfs_type_psaddr_t" >&6; }
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for elf_fpregset_t in sys/procfs.h" >&5
+$as_echo_n "checking for elf_fpregset_t in sys/procfs.h... " >&6; }
+ if ${bfd_cv_have_sys_procfs_type_elf_fpregset_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris.  */
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+int
+main ()
+{
+elf_fpregset_t avar
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  bfd_cv_have_sys_procfs_type_elf_fpregset_t=yes
+else
+  bfd_cv_have_sys_procfs_type_elf_fpregset_t=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_elf_fpregset_t = yes; then
+
+$as_echo "#define HAVE_ELF_FPREGSET_T 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_elf_fpregset_t" >&5
+$as_echo "$bfd_cv_have_sys_procfs_type_elf_fpregset_t" >&6; }
+
 
 
 
index 66fc6c633f3f96b056de9c9a9a802ce7ebc43b25..a469d0a7939446140e7e285d640f9aa7035b1dc1 100644 (file)
@@ -1296,7 +1296,7 @@ fi
 AC_HEADER_STDC
 # elf_hp.h is for HP/UX 64-bit shared library support.
 AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
-                  thread_db.h \
+                  thread_db.h linux/elf.h \
                  sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
                  sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
                  sys/reg.h sys/debugreg.h sys/select.h \
@@ -1528,6 +1528,7 @@ if test "$ac_cv_header_sys_procfs_h" = yes; then
   BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
   BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
   BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
+  BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
 
   dnl Check for broken prfpregset_t type
 
index 39f0e03c6f4d1fccc0d3204e753445c9b3170b11..ee9358d054aac7e8bee4bde4248a23f56ac4f357 100644 (file)
@@ -64,6 +64,15 @@ EXTERN_C_POP
 #include <sys/procfs.h>
 #endif
 
+/* Not all platforms bring in <linux/elf.h> via <sys/procfs.h>.  If
+   <sys/procfs.h> wasn't enough to find elf_fpregset_t, try the kernel
+   headers also (but don't if we don't need to).  */
+#ifndef HAVE_ELF_FPREGSET_T
+# ifdef HAVE_LINUX_ELF_H
+#  include <linux/elf.h>
+# endif
+#endif
+
 EXTERN_C_PUSH
 
 /* Functions in this interface return one of these status codes.  */