This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[SH][PATCH] SH Kernel compatibility
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 29 Jan 2009 14:40:39 +0000
- Subject: [SH][PATCH] SH Kernel compatibility
The existing glibc sources only build for SH4 with older versions of the
kernel headers (if at all).
Please apply this patch to allow building against Linux 2.6.28.
Basically it's just a question of defining some missing types, and
ensuring that others are not multiply defined.
I think this ought to be backward compatible.
Thanks
Andrew Stubbs
2009-01-29 Andrew Stubbs <ams@codesourcery.com>
glibc/
* sysdeps/unix/sysv/linux/sh/sys/procfs.h: Don't include asm/elf.h.
Include asm/ptrace.h.
(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.
* sysdeps/unix/sysv/linux/sys/ptrace.h (PTRACE_GETREGS): Undefine
before define.
(PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS): Likewise.
---
src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h | 15 ++++++++++++-
src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h | 2 -
src/glibc-mainline/sysdeps/unix/sysv/linux/sys/ptrace.h | 4 +++
3 files changed, 18 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,23 @@
#include <sys/types.h>
#include <sys/ucontext.h>
#include <sys/user.h>
-#include <asm/elf.h>
+#include <asm/ptrace.h>
__BEGIN_DECLS
+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 */
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sys/ptrace.h
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sys/ptrace.h.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sys/ptrace.h
@@ -72,21 +72,25 @@ enum __ptrace_request
/* Get all general purpose registers used by a processes.
This is not supported on all machines. */
+#undef PTRACE_GETREGS
PTRACE_GETREGS = 12,
#define PT_GETREGS PTRACE_GETREGS
/* Set all general purpose registers used by a processes.
This is not supported on all machines. */
+#undef PTRACE_SETREGS
PTRACE_SETREGS = 13,
#define PT_SETREGS PTRACE_SETREGS
/* Get all floating point registers used by a processes.
This is not supported on all machines. */
+#undef PTRACE_GETFPREGS
PTRACE_GETFPREGS = 14,
#define PT_GETFPREGS PTRACE_GETFPREGS
/* Set all floating point registers used by a processes.
This is not supported on all machines. */
+#undef PTRACE_SETFPREGS
PTRACE_SETFPREGS = 15,
#define PT_SETFPREGS PTRACE_SETFPREGS