From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108153 invoked by alias); 21 May 2019 02:52:17 -0000 Mailing-List: contact libc-help-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: libc-help-owner@sourceware.org Received: (qmail 108142 invoked by uid 89); 21 May 2019 02:52:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=mozilla, Mozilla, 4.3 X-HELO: mail-it1-f170.google.com Received: from mail-it1-f170.google.com (HELO mail-it1-f170.google.com) (209.85.166.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 May 2019 02:52:15 +0000 Received: by mail-it1-f170.google.com with SMTP id g23so1527278iti.1 for ; Mon, 20 May 2019 19:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:from:date:message-id:subject:to; bh=wLo4QvnlnQuTcaG045gyGJllJ18tCAMAa4j1gs+wR7U=; b=ihAa32dC4PZebZoDtg3T4hyklZeB1yJB6KpkR92ifGVfSymycoYifuu3KPTKoF08bZ MKS1MWhzjjRlNLF1ZAM2S/XPL76u3YIVOWmi/pO0XbQBMhbKjLLcCS5e/VfYEQTW5lrB r8KzUay+j1yIyKzZzxUoQNHQojd9YI9NMd7LMiw3lmkGpsHzhfsqYbsu3h8owtetrmXh Jllrah+SlB2L+3jQlbVp0qDuAtZZL/+mU/ROFx2HWxdIegcqd3NVWnAUSpJF2rZ7tbEa 7yN7bLfh7F/b6s7Am7dDYFf2zBkrrYZe9woC7+0TR137F4judcQKweTnanDBZZY28qXA l+Ew== MIME-Version: 1.0 Reply-To: noloader@gmail.com From: Jeffrey Walton Date: Tue, 21 May 2019 02:52:00 -0000 Message-ID: Subject: getauxv and ARMv7 platform detection To: libc-help@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00032.txt.bz2 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