From: Jeffrey Walton <noloader@gmail.com>
To: libc-help@sourceware.org
Subject: getauxv and ARMv7 platform detection
Date: Tue, 21 May 2019 02:52:00 -0000 [thread overview]
Message-ID: <CAH8yC8=ULU8tz-XrQvy2gnJ2B5tgSj-s-aMpd5m8E2wmTR4sRw@mail.gmail.com> (raw)
Hi Everyone,
I just noticed the following code was failing on ARMv7 platforms:
// For older machines, like GCC 4.3 on ARMv6
#ifndef HWCAP_ARMv7
# define HWCAP_ARMv7 (1 << 29)
#endif
inline bool CPU_QueryARMv7()
{
if (getauxval(AT_HWCAP) & HWCAP_ARMv7) != 0)
return true;
return false;
}
Looking through Torvalds GitHub [1] I don't see a reliable define for
HWCAP_ARMv7 in hwcap.h.
I know I can fallback to NEON, but that misses earlier devices that
are ARMv7 but lacks NEON.
Searching is turning up a lot of spurious noise (for Aarch64/ARMv8),
and one hit for Mozilla working around the same problem [2].
My question is, how do we use getauxval to detect ARMv7 platforms?
Thanks in advance.
[1] https://github.com/torvalds/linux/blob/master/arch/arm/include/uapi/asm/hwcap.h
[2] https://hg.mozilla.org/releases/mozilla-aurora/rev/522951ff7046fd2bdf3916c973fbfde27be0af31
next reply other threads:[~2019-05-21 2:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 2:52 Jeffrey Walton [this message]
2019-05-21 6:03 ` Florian Weimer
2019-05-21 6:11 ` Jeffrey Walton
2019-05-21 6:31 ` Florian Weimer
2019-05-21 6:45 ` Jeffrey Walton
2019-05-21 20:53 ` 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='CAH8yC8=ULU8tz-XrQvy2gnJ2B5tgSj-s-aMpd5m8E2wmTR4sRw@mail.gmail.com' \
--to=noloader@gmail.com \
--cc=libc-help@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).