From: Siddhesh Poyarekar <siddhesh@sourceware.org>
To: libc-alpha@sourceware.org
Cc: adhemerval.zanella@linaro.org
Subject: [PATCH 5/5] aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK
Date: Thu, 18 May 2017 20:07:00 -0000 [thread overview]
Message-ID: <1495138038-32212-6-git-send-email-siddhesh@sourceware.org> (raw)
In-Reply-To: <1495138038-32212-1-git-send-email-siddhesh@sourceware.org>
Now that LD_HWCAP_MASK (or glibc.tune.hwcap_mask) is read early enough
to influence cpu feature check in aarch64, use it to influence
multiarch selection. Setting LD_HWCAP_MASK such that it clears
HWCAP_CPUID will now disable multiarch for the binary.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c
(init_cpu_features): Use glibc.tune.hwcap_mask.
---
sysdeps/unix/sysv/linux/aarch64/cpu-features.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
index 7025062..0478fcc 100644
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -18,18 +18,25 @@
#include <cpu-features.h>
#include <sys/auxv.h>
+#include <elf/dl-tunables.h>
static inline void
init_cpu_features (struct cpu_features *cpu_features)
{
- if (GLRO(dl_hwcap) & HWCAP_CPUID)
+#if HAVE_TUNABLES
+ uint64_t hwcap_mask = TUNABLE_GET (glibc, tune, hwcap_mask, uint64_t);
+#else
+ uint64_t hwcap_mask = GLRO (dl_hwcap_mask);
+#endif
+
+ uint64_t hwcap = GLRO (dl_hwcap) & hwcap_mask;
+
+ if (hwcap & HWCAP_CPUID)
{
register uint64_t id = 0;
asm volatile ("mrs %0, midr_el1" : "=r"(id));
cpu_features->midr_el1 = id;
}
else
- {
- cpu_features->midr_el1 = 0;
- }
+ cpu_features->midr_el1 = 0;
}
--
2.7.4
next prev parent reply other threads:[~2017-05-18 20:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 20:07 [PATCH v2 0/5] aarch64: Allow overriding HWCAP_CPUID feature check Siddhesh Poyarekar
2017-05-18 20:07 ` [PATCH 4/5] Delay initialization of CPU features struct in static binaries Siddhesh Poyarekar
2017-05-25 3:05 ` H.J. Lu
2017-05-18 20:07 ` Siddhesh Poyarekar [this message]
2017-05-19 9:49 ` [PATCH 5/5] aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK Szabolcs Nagy
2017-05-19 17:44 ` Siddhesh Poyarekar
2017-05-19 22:12 ` Szabolcs Nagy
2017-05-20 3:32 ` Siddhesh Poyarekar
2017-05-20 12:35 ` Szabolcs Nagy
2017-05-20 13:23 ` Siddhesh Poyarekar
2017-05-18 20:07 ` [PATCH 3/5] tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask Siddhesh Poyarekar
2017-05-22 14:51 ` Adhemerval Zanella
2017-05-18 20:07 ` [PATCH 1/5] tunables: Add hooks to get and update tunables Siddhesh Poyarekar
2017-05-22 14:07 ` Adhemerval Zanella
2017-05-18 20:07 ` [PATCH 2/5] tunables: Add LD_HWCAP_MASK to tunables Siddhesh Poyarekar
2017-05-22 13:20 ` Adhemerval Zanella
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=1495138038-32212-6-git-send-email-siddhesh@sourceware.org \
--to=siddhesh@sourceware.org \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/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).