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
|
# DP: Allow hwcap's to be disabled with the existence of a file. This
# DP: makes it easier to do upgrades with optimized (hwcap) library
# DP: packages.
# DP: Author: Rewritten by Daniel Jacobowitz <dan@debian.org>
# DP: Upstream status: Debian-Specific
# DP: Status Details: This isn't going to be acceptable upstream, we
# DP: only need it because we support in-place upgrades.
# DP: Date: 2003-10-28, (Updated 2005-01-02 gotom, 2007-05-20 aurel32)
---
elf/dl-cache.c | 10 ++++++++++
elf/dl-hwcaps.c | 20 ++++++++++++++++++++
sysdeps/alpha/ldsodefs.h | 2 ++
3 files changed, 32 insertions(+)
--- a/elf/dl-hwcaps.c
+++ b/elf/dl-hwcaps.c
@@ -22,6 +22,9 @@
#include <libintl.h>
#include <unistd.h>
#include <ldsodefs.h>
+#include <fcntl.h>
+#include <sysdep.h>
+#include <not-errno.h>
#include <dl-procinfo.h>
#include <dl-hwcaps.h>
@@ -204,6 +207,23 @@
/* For TLS enabled builds always add 'tls'. */
++cnt;
+#ifdef NEED_LD_SO_NOHWCAP
+ if (__access_noerrno ("/etc/ld.so.nohwcap", F_OK) == 0)
+ {
+ /* If hwcap is disabled, we only have the base directory to search. */
+ result = (struct r_strlenpair *) malloc (sizeof (*result));
+ if (result == NULL)
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create capability list"));
+
+ result[0].str = (char *) result; /* Does not really matter. */
+ result[0].len = 0;
+
+ *sz = 1;
+ return result;
+ }
+#endif
+
/* Create temporary data structure to generate result table. */
struct r_strlenpair temp[cnt];
m = 0;
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -26,6 +26,9 @@
#include <_itoa.h>
#include <dl-hwcaps.h>
#include <dl-isa-level.h>
+#include <fcntl.h>
+#include <sysdep.h>
+#include <not-errno.h>
#ifndef _DL_PLATFORMS_COUNT
# define _DL_PLATFORMS_COUNT 0
@@ -216,6 +219,11 @@
#ifdef SHARED
uint32_t best_priority = 0;
#endif
+ int disable_hwcap = 0;
+#ifdef NEED_LD_SO_NOHWCAP
+ if (__access_noerrno ("/etc/ld.so.nohwcap", F_OK) == 0)
+ disable_hwcap = 1;
+#endif
while (left <= right)
{
@@ -297,6 +305,8 @@
if ((libnew->hwcap & hwcap_exclude) && !named_hwcap)
continue;
+ if (disable_hwcap && libnew->hwcap != 0)
+ continue;
if (_DL_PLATFORMS_COUNT
&& (libnew->hwcap & _DL_HWCAP_PLATFORM) != 0
&& ((libnew->hwcap & _DL_HWCAP_PLATFORM)
--- a/sysdeps/alpha/ldsodefs.h
+++ b/sysdeps/alpha/ldsodefs.h
@@ -37,6 +37,8 @@
struct La_alpha_retval *, \
const char *);
+#define NEED_LD_SO_NOHWCAP
+
#include_next <ldsodefs.h>
#endif
|