Submitted By: Joe Ciccone <jciccone@gmail.com>
Date: 2008-10-12
Initial Package Version: 2.8
Upstream Status: Reported & No Status
Origin: http://sources.redhat.com/bugzilla/show_bug.cgi?id=5216
        http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.8/6015_all_alpha-glibc-2.5-no-page-header.patch?rev=1.1&view=log
        http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.8/6016_all_alpha-glibc-2.5-no-asm-elf-header.patch?rev=1.1&view=log
        http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.8/6017_all_alpha-glibc-2.8-creat.patch?rev=1.1&view=log
        Joe Ciccone & http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.8/6018_all_alpha-glibc-2.8-cache-shape.patch?rev=1.1&view=log
Description: Fixes various problems on alpha.

diff -Naur glibc-2.8.orig/sysdeps/unix/alpha/sysdep.h glibc-2.8/sysdeps/unix/alpha/sysdep.h
--- glibc-2.8.orig/sysdeps/unix/alpha/sysdep.h	2006-03-03 06:21:28.000000000 -0500
+++ glibc-2.8/sysdeps/unix/alpha/sysdep.h	2008-10-12 12:31:17.000000000 -0400
@@ -397,42 +397,4 @@
 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
 }
 
-/* Pointer mangling support.  Note that tls access is slow enough that
-   we don't deoptimize things by placing the pointer check value there.  */
-
-#include <stdint.h>
-
-#if defined NOT_IN_libc && defined IS_IN_rtld
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(dst, src, tmp)				\
-	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
-	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
-	xor	src, tmp, dst
-#  define PTR_MANGLE2(dst, src, tmp)				\
-	xor	src, tmp, dst
-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
-# else
-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
-#  define PTR_MANGLE(var)	\
-  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
-# endif
-#elif defined PIC
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(dst, src, tmp)		\
-	ldq	tmp, __pointer_chk_guard;	\
-	xor	src, tmp, dst
-#  define PTR_MANGLE2(dst, src, tmp)		\
-	xor	src, tmp, dst
-#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
-#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
-# else
-extern uintptr_t __pointer_chk_guard attribute_relro;
-#  define PTR_MANGLE(var)	\
-	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
-#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
-# endif
-#endif
-
 #endif /* ASSEMBLER */
diff -Naur glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.8/sysdeps/unix/sysv/linux/alpha/dl-support.c
--- glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/dl-support.c	2007-03-13 17:25:16.000000000 -0400
+++ glibc-2.8/sysdeps/unix/sysv/linux/alpha/dl-support.c	2008-10-12 12:31:30.000000000 -0400
@@ -1,2 +1 @@
-#include "dl-auxv.h"
 #include <elf/dl-support.c>
diff -Naur glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2.8/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
--- glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2001-07-06 00:56:13.000000000 -0400
+++ glibc-2.8/sysdeps/unix/sysv/linux/alpha/sys/procfs.h	2008-10-12 12:31:17.000000000 -0400
@@ -29,10 +29,23 @@
 #include <sys/types.h>
 #include <sys/ucontext.h>
 #include <sys/user.h>
-#include <asm/elf.h>
 
 __BEGIN_DECLS
 
+/*
+ * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
+ * I have no idea why that is so.  For now, we just leave it at 33
+ * (32 general regs + processor status word). 
+ */
+#define ELF_NGREG	33
+#define ELF_NFPREG	32
+
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+typedef double elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+
 struct elf_siginfo
   {
     int si_signo;			/* Signal number.  */
diff -Naur glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2.8/sysdeps/unix/sysv/linux/alpha/sys/user.h
--- glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/sys/user.h	2001-07-06 00:56:13.000000000 -0400
+++ glibc-2.8/sysdeps/unix/sysv/linux/alpha/sys/user.h	2008-10-12 12:31:17.000000000 -0400
@@ -23,7 +23,6 @@
    only. Don't read too much into it. Don't use it for anything other
    than gdb/strace unless you know what you are doing. */
 
-#include <asm/page.h>
 #include <asm/reg.h>
 
 struct user
@@ -41,6 +40,9 @@
   char u_comm[32];				/* user command name */
 };
 
+#define PAGE_SHIFT		13
+#define PAGE_SIZE		(1 << PAGE_SHIFT)
+#define PAGE_MASK		(~(PAGE_SIZE-1))
 #define NBPG			PAGE_SIZE
 #define UPAGES			1
 #define HOST_TEXT_START_ADDR	(u.start_code)
diff -Naur glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.8/sysdeps/unix/sysv/linux/alpha/sysdep.h
--- glibc-2.8.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h	2007-08-21 04:07:28.000000000 -0400
+++ glibc-2.8/sysdeps/unix/sysv/linux/alpha/sysdep.h	2008-10-12 12:31:17.000000000 -0400
@@ -98,4 +98,46 @@
 	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
 })
 
+/* Pointer mangling support.  Note that tls access is slow enough that
+   we don't deoptimize things by placing the pointer check value there.  */
+
+#if defined NOT_IN_libc && defined IS_IN_rtld
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dst, src, tmp)                            \
+       ldah    tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+       ldq     tmp, __pointer_chk_guard_local(tmp) !gprellow;  \
+       xor     src, tmp, dst
+#  define PTR_MANGLE2(dst, src, tmp)                           \
+       xor     src, tmp, dst
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+#  define PTR_MANGLE(var)      \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
+# endif
+#elif defined PIC
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dst, src, tmp)            \
+       ldq     tmp, __pointer_chk_guard;       \
+       xor     src, tmp, dst
+#  define PTR_MANGLE2(dst, src, tmp)           \
+       xor     src, tmp, dst
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+#  define PTR_MANGLE(var)      \
+       (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
+# endif
+#else
+/* Pointer mangling is not yet supported for static libc on alpha.  */
+# ifndef __ASSEMBLER__
+#  define PTR_MANGLE(var)   (void) (var)
+#  define PTR_DEMANGLE(var) (void) (var)
+# endif
+#endif
+
 #endif /* _LINUX_ALPHA_SYSDEP_H */
diff -Naur glibc-2.8.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.8/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
--- glibc-2.8.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2007-11-10 14:34:26.000000000 -0500
+++ glibc-2.8/sysdeps/unix/sysv/linux/wordsize-64/creat64.c	2008-10-12 12:31:17.000000000 -0400
@@ -1 +1,5 @@
 /* Defined as alias for the syscall.  */
+#include <sysdep.h>
+#ifndef __NR_creat
+#include "../../../../../io/creat64.c"
+#endif
