From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87664 invoked by alias); 21 May 2019 20:53:43 -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 87440 invoked by uid 89); 21 May 2019 20:53:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f52.google.com Received: from mail-vs1-f52.google.com (HELO mail-vs1-f52.google.com) (209.85.217.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 May 2019 20:53:42 +0000 Received: by mail-vs1-f52.google.com with SMTP id w124so77759vsb.11 for ; Tue, 21 May 2019 13:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yF0eTpC7QrswZUPmhLkK0neQryX85n7k6elRMjPhrr4=; b=KN/MSMxNniS0m4P0yb4DCR1iCgwrZz/uVaos5yoqqW9PrCYWkW1ryuYBz4IQd3eaeY J4k9Z4MoWvIqtK5of2841rvCPHNbYbS2gOkGrSps4OCNpZaQHUbltVzceFg4RWM2NzwH pVr8mUE6KtlBV5bWWppgxJkh7WYmBC6dvSTLdDMk3qwv2MtQ9VXNxbqoulhf51DwSi0g wNSZ22M7lbfPkfEMuIOHd5L3L362tGaFrS8NdYRAPboQIHVSVLtH4hnDS2ezNt9O8Yzr 5k64IQNkouyf9MVKryoFSjXBODrO8fex513AExOXj2sfwHrankDultx8B2AaVtdtxQjI UdVA== Return-Path: Received: from [192.168.1.132] ([177.194.125.152]) by smtp.googlemail.com with ESMTPSA id p7sm3489656vsp.34.2019.05.21.13.53.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 13:53:39 -0700 (PDT) To: libc-help@sourceware.org References: <87zhngfip7.fsf@oldenburg2.str.redhat.com> <87mujgfhde.fsf@oldenburg2.str.redhat.com> From: Adhemerval Zanella Openpgp: preference=signencrypt Subject: Re: getauxv and ARMv7 platform detection Message-ID: <10b6df0c-a0d3-3322-0c22-48e766201e31@linaro.org> Date: Tue, 21 May 2019 20:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00039.txt.bz2 On 21/05/2019 03:45, Jeffrey Walton wrote: > On Tue, May 21, 2019 at 2:31 AM Florian Weimer wrote: >> >> * Jeffrey Walton: >> >>> On Tue, May 21, 2019 at 2:03 AM Florian Weimer wrote: >>>> >>>> * Jeffrey Walton: >>>> >>>>> My question is, how do we use getauxval to detect ARMv7 platforms? >>>> >>>> What is the actual problem you are trying to solve? >>> >>> I'm trying to detect if the platform is ARMv7 at runtime. >> >> Yes, but why? Just to print a diagnostic? > > We switch to ARMv7 and NEON implementations at runtime if the CPU > supports it. We can usually achieve 2x or 3x speedups over > ARMv{4|5|6}. > > We've got SIGILL probes in place but they are an expensive fallback. > We prefer a faster and cleaner solution on Linux like getauxv(). > > We don't control how the library is built. Users and distros do their > own things. About the only thing we can count on is, -march=native is > useless (and sometimes segfaults the compiler), -march=XXX is missing > and -mfpu=YYY is missing. > Unfortunately hwcap does not export this information, you will need to parse /proc/cpuinfo 'CPU architecture' field and take some issues in consideration. Check google cpu_features project [1], it provides such information through a library. [1] https://github.com/google/cpu_features/blob/master/src/cpuinfo_arm.c