From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix hwcap handling in ld.so
Date: Thu, 18 Mar 2004 14:53:00 -0000 [thread overview]
Message-ID: <20040318124411.GE6393@sunsite.ms.mff.cuni.cz> (raw)
Hi!
Wonder why this has been broken for so long unnoticed.
unsigned long long x, y;
...
(x & y) > x
is 0 for any x, y.
Guess I should add a GCC warning for this kind of things.
I believe the following patch is correct and seems to work for me
on both PIII (where it doesn't decide to use a /usr/lib/sse2/ library
neither without nor with LD_LIBRARY_PATH=/usr/lib, without this
patch it happily uses /usr/lib/sse2/ library without
LD_LIBRARY_PATH=/usr/lib, but doesn't use it with the env var)
and on x86-64 (where it uses /usr/lib/sse2/).
When GLRO(dl_osversion) is referenced in dl-cache.c, I don't see how
GLRO(dl_hwcap) could be undefined, since it is for statically linked
apps defined in dl-support.c together with _dl_osversion.
2004-03-18 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Remove hwcap
variable and weak_extern for _dl_hwcap.
(_DL_HWCAP_TLS_MASK): Define.
(HWCAP_CHECK): Fix checking of non-platform hwcap bits. Use
lib->osversion instead of cache_new->libs[middle].osversion.
--- libc/sysdeps/generic/dl-cache.c.jj 2004-03-08 12:01:51.000000000 +0100
+++ libc/sysdeps/generic/dl-cache.c 2004-03-18 14:55:34.774381649 +0100
@@ -243,12 +243,7 @@ _dl_load_cache_lookup (const char *name)
if (cache_new != (void *) -1)
{
- /* This file ends in static libraries where we don't have a hwcap. */
- unsigned long int *hwcap;
uint64_t platform;
-#ifndef SHARED
- weak_extern (_dl_hwcap);
-#endif
/* This is where the strings start. */
cache_data = (const char *) cache_new;
@@ -256,22 +251,25 @@ _dl_load_cache_lookup (const char *name)
/* Now we can compute how large the string table is. */
cache_data_size = (const char *) cache + cachesize - cache_data;
- hwcap = &GLRO(dl_hwcap);
platform = _dl_string_platform (GLRO(dl_platform));
if (platform != (uint64_t) -1)
platform = 1ULL << platform;
/* Only accept hwcap if it's for the right platform. */
+#ifdef USE_TLS
+# define _DL_HWCAP_TLS_MASK (1LL << 63)
+#else
+# define _DL_HWCAP_TLS_MASK 0
+#endif
#define HWCAP_CHECK \
- if (GLRO(dl_osversion) \
- && cache_new->libs[middle].osversion > GLRO(dl_osversion)) \
+ if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \
continue; \
if (_DL_PLATFORMS_COUNT && platform != -1 \
&& (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \
&& (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \
continue; \
- if (hwcap \
- && ((lib->hwcap & *hwcap & ~_DL_HWCAP_PLATFORM) > *hwcap)) \
+ if (lib->hwcap \
+ & ~(GLRO(dl_hwcap) | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK)) \
continue
SEARCH_CACHE (cache_new);
}
Jakub
reply other threads:[~2004-03-18 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040318124411.GE6393@sunsite.ms.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).