This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [SH][PATCH] SH Kernel compatibility
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 02 Feb 2009 10:04:22 +0000
- Subject: Re: [SH][PATCH] SH Kernel compatibility
- References: <4981BFE7.5080000@codesourcery.com> <200901301700.23908.vapier@gentoo.org>
Mike Frysinger wrote:
the other changes are correct (Gentoo has had pretty much the same patch since
glibc-2.5), but i think this is part is wrong. fix your kernel headers
instead.
-mike
I'm using unmodified Linux 2.6.29-rc2 headers. A quick grep shows that
the SH headers are not unusual in defining these macros.
I think the problem is that I have added an include of asm/ptrace.h in
sys/procfs.h (to get struct pt_regs).
This updated patch undefs the values at the point they are included.
Hopefully this is a better solution?
Andrew
2009-02-02 Andrew Stubbs <ams@codesourcery.com>
glibc/
* sysdeps/unix/sysv/linux/sh/sys/procfs.h: Don't include asm/elf.h.
Include asm/ptrace.h.
(PTRACE_GETREGS, PTRACE_SETREGS): Undefine.
(PTRACE_GETFPREGS, PTRACE_SETFPREGS): Undefine.
(elf_greg_t, ELF_NGREG, elf_gregset_t, user_fpu_struct,
elf_fpregset_t): Copy from linux asm-sh/elf.h.
* sysdeps/unix/sysv/linux/sh/sys/user.h: Don't include asm/user.h.
---
src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h | 21 ++++++++++++-
src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h | 2 -
2 files changed, 20 insertions(+), 3 deletions(-)
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h
@@ -29,10 +29,29 @@
#include <sys/types.h>
#include <sys/ucontext.h>
#include <sys/user.h>
-#include <asm/elf.h>
+#include <asm/ptrace.h>
__BEGIN_DECLS
+/* These are defined by asm/ptrace.h, but clash with sys/ptrace.h. */
+#undef PTRACE_GETREGS
+#undef PTRACE_SETREGS
+#undef PTRACE_GETFPREGS
+#undef PTRACE_SETFPREGS
+
+typedef unsigned long elf_greg_t;
+
+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+struct user_fpu_struct {
+ unsigned long fp_regs[16];
+ unsigned long xfp_regs[16];
+ unsigned long fpscr;
+ unsigned long fpul;
+};
+typedef struct user_fpu_struct elf_fpregset_t;
+
struct elf_siginfo
{
int si_signo; /* Signal number. */
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h
@@ -21,8 +21,6 @@
#include <features.h>
-#include <asm/user.h>
-
#undef start_thread
#endif /* sys/user.h */