aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/glibc/glibc-2.3.2/glibc23-sse-oldkernel.patch
blob: ed58db835b78cefb6e60883de79eaeecbd0adcb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
--- glibc-2.3.2/sysdeps/i386/dl-machine.h.orig	2003-11-01 15:52:17.000000000 -0500
+++ glibc-2.3.2/sysdeps/i386/dl-machine.h	2003-11-01 15:52:55.000000000 -0500
@@ -25,6 +25,7 @@
 #include <sys/param.h>
 #include <sysdep.h>
 #include <tls.h>
+#include <dl-procinfo.h>
 
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int __attribute__ ((unused))
@@ -357,6 +358,10 @@ dl_platform_init (void)
   if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0')
     /* Avoid an empty string which would disturb us.  */
     GL(dl_platform) = NULL;
+
+#ifdef DL_ADJUST_PROCINFO
+  DL_ADJUST_PROCINFO;
+#endif
 }
 
 static inline Elf32_Addr
--- glibc-2.3.2/sysdeps/unix/sysv/linux/i386/dl-procinfo.h.orig	2003-11-01 15:50:41.000000000 -0500
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/i386/dl-procinfo.h	2003-11-01 15:51:48.000000000 -0500
@@ -126,4 +126,20 @@ _dl_string_platform (const char *str)
   return -1;
 };
 
+#define DL_ADJUST_PROCINFO dl_adjust_procinfo ()
+
+static inline void
+__attribute__ ((unused, always_inline))
+dl_adjust_procinfo (void)
+{
+  if (GL(dl_osversion) < 0x020400)
+    {
+      /* Unfortunately, while the capability is named OSFXSR, it's
+	 actually hardware FXSR direct from CPUID.  And we can't test
+	 CR4 ourselves, because we're in protected mode.  Disable it
+	 for kernels which might not have actually enabled OSFXSR.  */
+      GL(dl_hwcap) &= ~(HWCAP_I386_OSFXSR | HWCAP_I386_XMM | HWCAP_I386_XMM2);
+    }
+}
+
 #endif /* dl-procinfo.h */
--- glibc-2.3.2/sysdeps/generic/libc-start.c.orig	2003-11-02 23:11:51.000000000 -0500
+++ glibc-2.3.2/sysdeps/generic/libc-start.c	2003-11-02 23:34:42.000000000 -0500
@@ -23,6 +23,10 @@
 #include <bp-start.h>
 #include <bp-sym.h>
 
+#include <dl-osinfo.h>
+#include <dl-librecon.h>
+#include <dl-machine.h>
+
 extern void __libc_init_first (int argc, char **argv, char **envp);
 
 extern int __libc_multiple_libcs;
@@ -123,15 +127,28 @@ LIBC_START_MAIN (int (*main) (int, char 
 #  endif
   _dl_aux_init (auxvec);
 # endif
-# ifdef DL_SYSDEP_OSCHECK
   if (!__libc_multiple_libcs)
     {
+# ifdef DL_SYSDEP_OSCHECK
       /* This needs to run to initiliaze _dl_osversion before TLS
 	 setup might check it.  */
       DL_SYSDEP_OSCHECK (__libc_fatal);
-    }
 # endif
 
+  /* Moved here so that we can frob hwcap early enough.  */
+# ifdef DL_OSVERSION_INIT
+      DL_OSVERSION_INIT;
+# endif
+
+# ifdef DL_PLATFORM_INIT
+      DL_PLATFORM_INIT;
+# endif
+
+      /* Now determine the length of the platform string.  */
+      if (_dl_platform != NULL)
+	_dl_platformlen = strlen (_dl_platform);
+    }
+
   /* Initialize the thread library at least a bit since the libgcc
      functions are using thread functions if these are available and
      we need to setup errno.  If there is no thread library and we
--- glibc-2.3.2/elf/dl-support.c.orig	2003-11-02 22:55:47.000000000 -0500
+++ glibc-2.3.2/elf/dl-support.c	2003-11-02 23:24:40.000000000 -0500
@@ -252,18 +252,6 @@ _dl_non_dynamic_init (void)
       if (__access ("/etc/suid-debug", F_OK) != 0)
 	unsetenv ("MALLOC_CHECK_");
     }
-
-#ifdef DL_PLATFORM_INIT
-  DL_PLATFORM_INIT;
-#endif
-
-#ifdef DL_OSVERSION_INIT
-  DL_OSVERSION_INIT;
-#endif
-
-  /* Now determine the length of the platform string.  */
-  if (_dl_platform != NULL)
-    _dl_platformlen = strlen (_dl_platform);
 }