This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SH][PATCH] SH Kernel compatibility


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 */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]