summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEldar Abusalimov <eldar.abusalimov@jetbrains.com>2018-01-17 13:13:15 +0000
committerPedro Alves <palves@redhat.com>2018-01-17 13:13:15 +0000
commit6949085e3eaef536b2c76252452ec3e63e9f112c (patch)
tree599a3714a28d119d0a4927d29a62e6d5ff342ed5
parent94485cac9629ca3e5489014e1b704e35f988d3e3 (diff)
configure: Fix test for fs_base/gs_base in <sys/user.h>gdb-8.1-branch
Make <sys/types.h> be included prior to including <sys/user.h>. glibc versions older than 2.14 use __uintNN_t types within certain structures defined in <sys/user.h> probably assuming these types are defined prior to including the header. This results in the following `configure` feature test compilation error that makes it think that `struct user_regs_struct` doesn't have `fs_base`/`gs_base` fields, althouh it does. configure:13617: checking for struct user_regs_struct.fs_base configure:13617: gcc -c -g -O2 -I/linux/include conftest.c >&5 In file included from conftest.c:158:0: /usr/include/sys/user.h:32:3: error: unknown type name '__uint16_t' __uint16_t cwd; ^ /usr/include/sys/user.h:33:3: error: unknown type name '__uint16_t' __uint16_t swd; ^ /usr/include/sys/user.h:34:3: error: unknown type name '__uint16_t' __uint16_t ftw; ^ /usr/include/sys/user.h:35:3: error: unknown type name '__uint16_t' __uint16_t fop; ^ /usr/include/sys/user.h:36:3: error: unknown type name '__uint64_t' __uint64_t rip; ^ /usr/include/sys/user.h:37:3: error: unknown type name '__uint64_t' __uint64_t rdp; ^ /usr/include/sys/user.h:38:3: error: unknown type name '__uint32_t' __uint32_t mxcsr; ^ /usr/include/sys/user.h:39:3: error: unknown type name '__uint32_t' __uint32_t mxcr_mask; ^ /usr/include/sys/user.h:40:3: error: unknown type name '__uint32_t' __uint32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ ^ /usr/include/sys/user.h:41:3: error: unknown type name '__uint32_t' __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ^ /usr/include/sys/user.h:42:3: error: unknown type name '__uint32_t' __uint32_t padding[24]; ^ configure:13617: $? = 1 configure: failed program was: | /* confdefs.h */ ... | /* end confdefs.h. */ | #include <sys/user.h> | | int | main () | { | static struct user_regs_struct ac_aggr; | if (ac_aggr.fs_base) | return 0; | ; | return 0; | } Recent glibc versions don't use typedef'ed int types in <sys/user.h>, thus allowing it to be included as is (glibc commit d79a9c949c84e7f0ba33e87447c47af833e9f11a). However there're still some distros alive that use older glibc, for instance, RHEL/CentOS 6 package glibc 2.12. Also affects PR gdb/21559: ../../gdb/regcache.c:1087: internal-error: void regcache_raw_supply(regcache, int, const void): Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed. As noted by Andrew Paprocki, who submitted the PR (https://sourceware.org/bugzilla/show_bug.cgi?id=21559#c3): > It should be noted that modifying `configure` to force on > `HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE` and > `HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE` fixes this issue. For some > reason the `configure` tests for `fs_base` and `gs_base` fail > even though `sys/user.h` on RHEL5 has the fields defined in > `user_regs_struct`. Note that this patch does NOT fix the root cause of PR gdb/21559, although now that `configure` properly detects the presence of the fields and sets HAVE_XXX accordingly, the execution takes another path, which doesn't lead to the assertion failure in question. gdb/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate.
-rw-r--r--gdb/ChangeLog7
-rwxr-xr-xgdb/configure6
-rw-r--r--gdb/configure.ac3
-rw-r--r--gdb/gdbserver/ChangeLog7
-rwxr-xr-xgdb/gdbserver/configure6
-rw-r--r--gdb/gdbserver/configure.ac3
6 files changed, 26 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 52139d8425..3bb66d163b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com>
+
+ PR gdb/21559
+ * configure.ac: Include <sys/types.h> prior to <sys/user.h> when
+ checking for fs_base/gs_base fields in struct user_regs_struct.
+ * configure: Regenerate.
+
2018-01-17 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c (aarch64_linux_gcc_target_options): New
diff --git a/gdb/configure b/gdb/configure
index db610f32fc..092893d757 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -14072,7 +14072,8 @@ fi
# See if <sys/user.h> supports the %fs_base and %gs_bas amd64 segment registers.
# Older amd64 Linux's don't have the fs_base and gs_base members of
# `struct user_regs_struct'.
-ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include <sys/user.h>
+ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include <sys/types.h>
+#include <sys/user.h>
"
if test "x$ac_cv_member_struct_user_regs_struct_fs_base" = x""yes; then :
@@ -14082,7 +14083,8 @@ _ACEOF
fi
-ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "gs_base" "ac_cv_member_struct_user_regs_struct_gs_base" "#include <sys/user.h>
+ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "gs_base" "ac_cv_member_struct_user_regs_struct_gs_base" "#include <sys/types.h>
+#include <sys/user.h>
"
if test "x$ac_cv_member_struct_user_regs_struct_gs_base" = x""yes; then :
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 3db44ae758..d4133ea71e 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1459,7 +1459,8 @@ AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
# Older amd64 Linux's don't have the fs_base and gs_base members of
# `struct user_regs_struct'.
AC_CHECK_MEMBERS([struct user_regs_struct.fs_base, struct user_regs_struct.gs_base],
- [], [], [#include <sys/user.h>])
+ [], [], [#include <sys/types.h>
+#include <sys/user.h>])
# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
AC_MSG_CHECKING(for PTRACE_GETREGS)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 6475f1d26a..4029a5eb66 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com>
+
+ PR gdb/21559
+ * configure.ac: Include <sys/types.h> prior to <sys/user.h> when
+ checking for fs_base/gs_base fields in struct user_regs_struct.
+ * configure: Regenerate.
+
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index ca51321c84..340ca7a19e 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -7525,7 +7525,8 @@ fi
# See if <sys/user.h> supports the %fs_base and %gs_bas amd64 segment registers.
# Older amd64 Linux's don't have the fs_base and gs_base members of
# `struct user_regs_struct'.
-ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include <sys/user.h>
+ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include <sys/types.h>
+#include <sys/user.h>
"
if test "x$ac_cv_member_struct_user_regs_struct_fs_base" = x""yes; then :
@@ -7535,7 +7536,8 @@ _ACEOF
fi
-ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "gs_base" "ac_cv_member_struct_user_regs_struct_gs_base" "#include <sys/user.h>
+ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "gs_base" "ac_cv_member_struct_user_regs_struct_gs_base" "#include <sys/types.h>
+#include <sys/user.h>
"
if test "x$ac_cv_member_struct_user_regs_struct_gs_base" = x""yes; then :
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 7ea3654f63..6727959e61 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -185,7 +185,8 @@ AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize])
# Older amd64 Linux's don't have the fs_base and gs_base members of
# `struct user_regs_struct'.
AC_CHECK_MEMBERS([struct user_regs_struct.fs_base, struct user_regs_struct.gs_base],
- [], [], [#include <sys/user.h>])
+ [], [], [#include <sys/types.h>
+#include <sys/user.h>])
AC_CHECK_TYPES(socklen_t, [], [],