From patchwork Mon Jan 18 18:22:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cseo X-Patchwork-Id: 569645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3067C140B97 for ; Tue, 19 Jan 2016 05:23:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=G/1uZFQe; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:cc:message-id:date :mime-version:content-type; q=dns; s=default; b=rrtUETfG7ANS7tRm oFlysot8GBBHQEzgB5dwSqaytgEJd7LSshKWmHgRHJqq5eAWsJOyeUX6n5Gou07k DypLZLLjVAnH/NxYF9pL5iXL+br5aU7LxLgCg5naU+xi8qJgmLcD5MNyq1HsjsoT NuloE2dnTeYWk9pbqhEmb/glOk4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:cc:message-id:date :mime-version:content-type; s=default; bh=8b+kTAQD/8Mre7gWxCNUAC 3WRk0=; b=G/1uZFQeLStoVWSHSxwpAHJw9i6ryyYas0Rx5IfNTXP8JaLsG09Zsp ECcqw+z+FqEXrJ887xetkXc/F/wCWIP8KfhxttvCtR7AgXdN2TkoewUP2qxj3viU zU0rRU3dmkkQcWxffrhNAIVR6UmJS6cB0YuTSHDzABB6Q5z1tqNhA= Received: (qmail 29448 invoked by alias); 18 Jan 2016 18:23:06 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 29436 invoked by uid 89); 18 Jan 2016 18:23:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=AWL, BAYES_05, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=seo, smt, 797, 79, 7 X-HELO: e24smtp03.br.ibm.com X-IBM-Helo: d24dlp02.br.ibm.com X-IBM-MailFrom: cseo@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org To: GLIBC From: Carlos Eduardo Seo Subject: [PATCH] powerpc: Fix dl-procinfo HWCAP Cc: Tulio Magno Quites Machado Filho , Steve Munroe Message-ID: <569D2D7B.30101@linux.vnet.ibm.com> Date: Mon, 18 Jan 2016 16:22:51 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16011818-0025-0000-0000-000005CC6D7A Hi This is a bug fix. There are 4 unused bits in HWCAP and space must be reserved for them in _dl_powerpc_cap_flags so the code iterates through all the 32 capabilities, otherwise you may get a wrong AT_HWCAP displayed when LD_SHOW_AUXV=1. If possible, I'd like this in 2.23. Regards, diff --git a/sysdeps/powerpc/dl-procinfo.c b/sysdeps/powerpc/dl-procinfo.c index a8df5b8..5604366 100644 --- a/sysdeps/powerpc/dl-procinfo.c +++ b/sysdeps/powerpc/dl-procinfo.c @@ -45,11 +45,12 @@ #if !defined PROCINFO_DECL && defined SHARED ._dl_powerpc_cap_flags #else -PROCINFO_CLASS const char _dl_powerpc_cap_flags[60][10] +PROCINFO_CLASS const char _dl_powerpc_cap_flags[64][10] #endif #ifndef PROCINFO_DECL = { - "ppcle", "true_le", "archpmu", "vsx", + "ppcle", "true_le", "", "", + "", "", "archpmu", "vsx", "arch_2_06", "power6x", "dfp", "pa6t", "arch_2_05", "ic_snoop", "smt", "booke", "cellbe", "power5+", "power5", "power4", diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h index 407149b..80e70e5 100644 --- a/sysdeps/powerpc/dl-procinfo.h +++ b/sysdeps/powerpc/dl-procinfo.h @@ -22,9 +22,6 @@ #include #include /* This defines the PPC_FEATURE[2]_* macros. */ -/* There are 28 bits used, but they are bits 4..31. */ -#define _DL_HWCAP_FIRST 4 - /* The total number of available bits (including those prior to _DL_HWCAP_FIRST). Some of these bits might not be used. */ #define _DL_HWCAP_COUNT 64 @@ -68,7 +65,7 @@ static inline const char * __attribute__ ((unused)) _dl_hwcap_string (int idx) { - return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST]; + return GLRO(dl_powerpc_cap_flags)[idx]; } static inline const char * @@ -82,7 +79,7 @@ static inline int __attribute__ ((unused)) _dl_string_hwcap (const char *str) { - for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i) + for (int i = 0; i < _DL_HWCAP_COUNT; ++i) if (strcmp (str, _dl_hwcap_string (i)) == 0) return i; return -1; @@ -180,7 +177,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) case AT_HWCAP: _dl_printf ("AT_HWCAP: "); - for (int i = _DL_HWCAP_FIRST; i <= _DL_HWCAP_LAST; ++i) + for (int i = 0; i <= _DL_HWCAP_LAST; ++i) if (word & (1 << i)) _dl_printf (" %s", _dl_hwcap_string (i)); break;