From: Kyle McMartin Date: Mon, 9 Jun 2014 19:06:26 +0000 (+0200) Subject: aarch64: use defined register structures X-Git-Tag: elfutils-0.160~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c1e0fcb9311c1d136e20e658449367ad8b7f487d;p=thirdparty%2Felfutils.git aarch64: use defined register structures glibc now supplies these (compatible) structs instead of including the kernel's header, so let's use them. Annoyingly this will cause new elfutils to FTBFS on old glibc, and vice versa. So include a new configure check for the new struct names and use the old ones if they are not avilable. Signed-off-by: Kyle McMartin Signed-off-by: Mark Wielaard --- diff --git a/ChangeLog b/ChangeLog index b05f5bc53..b470b3d78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-07-18 Mark Wielaard + + * configure.ac (AC_CHECK_TYPE): Test for struct user_regs_struct. + 2014-05-26 Mark Wielaard * NEWS: New section 0.160. Add unstrip --force. diff --git a/backends/ChangeLog b/backends/ChangeLog index d29a80f6a..a335b2075 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,12 @@ +2014-07-18 Kyle McMartin + Mark Wielaard + + * aarch64_initreg.c: Check HAVE_SYS_USER_REGS. + (aarch64_set_initial_registers_tid): Use user_regs_struct and + user_fpsimd_struct. + * arm_initreg.c: Check HAVE_SYS_USER_REGS. + (arm_set_initial_registers_tid): Use user_regs_struct in compat mode. + 2014-07-04 Menanteau Guy Mark Wielaard diff --git a/backends/aarch64_initreg.c b/backends/aarch64_initreg.c index 2492d5619..9706205e8 100644 --- a/backends/aarch64_initreg.c +++ b/backends/aarch64_initreg.c @@ -1,5 +1,5 @@ /* Fetch live process registers from TID. - Copyright (C) 2013 Red Hat, Inc. + Copyright (C) 2013, 2014 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -36,6 +36,11 @@ # include # include # include +/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ +# ifndef HAVE_SYS_USER_REGS +# define user_regs_struct user_pt_regs +# define user_fpsimd_struct user_fpsimd_state +# endif #endif #define BACKEND aarch64_ @@ -51,7 +56,7 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), #else /* __aarch64__ */ /* General registers. */ - struct user_pt_regs gregs; + struct user_regs_struct gregs; struct iovec iovec; iovec.iov_base = &gregs; iovec.iov_len = sizeof (gregs); @@ -69,7 +74,7 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), /* ELR cannot be found. */ /* FP registers (only 64bits are used). */ - struct user_fpsimd_state fregs; + struct user_fpsimd_struct fregs; iovec.iov_base = &fregs; iovec.iov_len = sizeof (fregs); if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0) diff --git a/backends/arm_initreg.c b/backends/arm_initreg.c index 5837383a8..a0a9be942 100644 --- a/backends/arm_initreg.c +++ b/backends/arm_initreg.c @@ -40,6 +40,10 @@ # include # include # include +/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ +# ifndef HAVE_SYS_USER_REGS +# define user_regs_struct user_pt_regs +# endif #endif #define BACKEND arm_ @@ -67,7 +71,7 @@ arm_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), #elif defined __aarch64__ /* Compat mode: arm compatible code running on aarch64 */ int i; - struct user_pt_regs gregs; + struct user_regs_struct gregs; struct iovec iovec; iovec.iov_base = &gregs; iovec.iov_len = sizeof (gregs); diff --git a/configure.ac b/configure.ac index 1d79597a3..f9c3c3051 100644 --- a/configure.ac +++ b/configure.ac @@ -301,6 +301,19 @@ eu_version=$(( (eu_version + 999) / 1000 )) AC_CHECK_SIZEOF(long) +# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead +# of the user_regs_struct from sys/user.h. They are structurally the same +# but we get either one or the other. +AC_CHECK_TYPE([struct user_regs_struct], + [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no], + [[#include ] + [#include ] + [#include ]]) +if test "$sys_user_has_user_regs" = "yes"; then + AC_DEFINE(HAVE_SYS_USER_REGS, 1, + [Define to 1 if defines struct user_regs_struct]) +fi + # On a 64-bit host where can can use $CC -m32, we'll run two sets of tests. # Likewise in a 32-bit build on a host where $CC -m64 works. utrace_BIARCH