about summary refs log tree commit diff
path: root/elf/dl-cache.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2010-04-05 19:43:05 -0700
committerRoland McGrath <roland@redhat.com>2010-04-05 19:47:27 -0700
commit7bfa311ff51999f9e92620268e493959a2f7bfb4 (patch)
treee08947e3d3a2774e2701bac49b3083900ea232c4 /elf/dl-cache.c
parent4dd019e3a1c68e2988ac35a97c95a59cd307eb05 (diff)
downloadglibc-7bfa311ff51999f9e92620268e493959a2f7bfb4.tar.gz
glibc-7bfa311ff51999f9e92620268e493959a2f7bfb4.tar.xz
glibc-7bfa311ff51999f9e92620268e493959a2f7bfb4.zip
Obey LD_HWCAP_MASK in ld.so.cache lookups. roland/hwcap_mask
Diffstat (limited to 'elf/dl-cache.c')
-rw-r--r--elf/dl-cache.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index bbeba77e4a..5a01c2ed1d 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -1,5 +1,6 @@
 /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
-   Copyright (C) 1996-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2002,2003,2004,2006,2010
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -255,17 +256,19 @@ _dl_load_cache_lookup (const char *name)
       if (platform != (uint64_t) -1)
 	platform = 1ULL << platform;
 
-      /* Only accept hwcap if it's for the right platform.  */
 #define _DL_HWCAP_TLS_MASK (1LL << 63)
+      uint64_t hwcap_exclude = ~((GLRO(dl_hwcap) & GLRO(dl_hwcap_mask))
+				 | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK);
+
+      /* Only accept hwcap if it's for the right platform.  */
 #define HWCAP_CHECK \
+      if (lib->hwcap & hwcap_exclude)					      \
+	continue;							      \
       if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion))	      \
 	continue;							      \
       if (_DL_PLATFORMS_COUNT						      \
 	  && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0			      \
 	  && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform)		      \
-	continue;							      \
-      if (lib->hwcap							      \
-	  & ~(GLRO(dl_hwcap) | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK))      \
 	continue
       SEARCH_CACHE (cache_new);
     }