summaryrefslogtreecommitdiff
path: root/glibc/glibc-2.3.2/ldso-disable-hwcap.patch
blob: 5538d206728a49629dda7753027ddfad761ec916 (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
--- glibc-2.3.2/sysdeps/generic/dl-sysdep.c.orig	2003-10-28 12:22:33.000000000 -0500
+++ glibc-2.3.2/sysdeps/generic/dl-sysdep.c	2003-10-28 12:38:49.000000000 -0500
@@ -354,7 +354,11 @@ _dl_important_hwcaps (const char *platfo
 #ifdef USE_TLS
   /* For TLS enabled builds always add 'tls'.  */
   ++cnt;
-#else
+#endif
+
+  if (__access ("/etc/ld.so.nohwcap", F_OK) == 0)
+    cnt = 0;
+
   if (cnt == 0)
     {
       /* If we have platform name and no important capability we only have
@@ -369,7 +373,6 @@ _dl_important_hwcaps (const char *platfo
       *sz = 1;
       return result;
     }
-#endif
 
   /* Create temporary data structure to generate result table.  */
   temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
@@ -411,9 +414,7 @@ _dl_important_hwcaps (const char *platfo
   result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
   if (result == NULL)
     {
-#ifndef USE_TLS
     no_memory:
-#endif
       INTUSE(_dl_signal_error) (ENOMEM, NULL, NULL,
 				N_("cannot create capability list"));
     }
--- glibc-2.3.2/sysdeps/generic/dl-cache.c.orig	2003-10-28 12:32:36.000000000 -0500
+++ glibc-2.3.2/sysdeps/generic/dl-cache.c	2003-10-28 12:38:57.000000000 -0500
@@ -246,6 +246,7 @@ _dl_load_cache_lookup (const char *name)
       /* This file ends in static libraries where we don't have a hwcap.  */
       unsigned long int *hwcap;
       uint64_t platform;
+      int disable_hwcap = 0;
 #ifndef SHARED
       weak_extern (_dl_hwcap);
 #endif
@@ -261,6 +262,9 @@ _dl_load_cache_lookup (const char *name)
       if (platform != (uint64_t) -1)
 	platform = 1ULL << platform;
 
+      if (__access ("/etc/ld.so.nohwcap", F_OK) == 0)
+	disable_hwcap = 1;
+
 #ifdef USE_TLS
 # define TLS_BIT (1ULL << 63)
 #else
@@ -272,6 +276,8 @@ _dl_load_cache_lookup (const char *name)
       if (GL(dl_osversion)						      \
 	  && cache_new->libs[middle].osversion > GL(dl_osversion))	      \
 	continue;							      \
+      if (disable_hwcap && lib->hwcap != 0)				      \
+	continue;							      \
       if (_DL_PLATFORMS_COUNT && platform != -1				      \
 	  && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0			      \
 	  && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform)		      \