c65238
commit 911569d02dec023d949d96aa7b0e828c91c06f55
c65238
Author: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
c65238
Date:   Mon Dec 28 16:36:46 2015 -0200
c65238
c65238
    powerpc: Fix dl-procinfo HWCAP
c65238
    
c65238
    HWCAP-related code should had been updated when the 32 bits of HWCAP were
c65238
    used.  This patch updates the code in dl-procinfo.h to loop through all
c65238
    the 32 bits in HWCAP and updates _dl_powerpc_cap_flags accordingly.
c65238
c65238
diff --git a/sysdeps/powerpc/dl-procinfo.c b/sysdeps/powerpc/dl-procinfo.c
c65238
index 6e7850e..0b55906 100644
c65238
--- a/sysdeps/powerpc/dl-procinfo.c
c65238
+++ b/sysdeps/powerpc/dl-procinfo.c
c65238
@@ -45,11 +45,12 @@
c65238
 #if !defined PROCINFO_DECL && defined SHARED
c65238
   ._dl_powerpc_cap_flags
c65238
 #else
c65238
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[60][10]
c65238
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[64][10]
c65238
 #endif
c65238
 #ifndef PROCINFO_DECL
c65238
 = {
c65238
-    "ppcle", "true_le", "archpmu", "vsx",
c65238
+    "ppcle", "true_le", "", "",
c65238
+    "", "", "archpmu", "vsx",
c65238
     "arch_2_06", "power6x", "dfp", "pa6t",
c65238
     "arch_2_05", "ic_snoop", "smt", "booke",
c65238
     "cellbe", "power5+", "power5", "power4",
c65238
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
c65238
index bce3a49..2187c5e 100644
c65238
--- a/sysdeps/powerpc/dl-procinfo.h
c65238
+++ b/sysdeps/powerpc/dl-procinfo.h
c65238
@@ -22,9 +22,6 @@
c65238
 #include <ldsodefs.h>
c65238
 #include <sysdep.h>	/* This defines the PPC_FEATURE[2]_* macros.  */
c65238
 
c65238
-/* There are 28 bits used, but they are bits 4..31.  */
c65238
-#define _DL_HWCAP_FIRST		4
c65238
-
c65238
 /* The total number of available bits (including those prior to
c65238
    _DL_HWCAP_FIRST).  Some of these bits might not be used.  */
c65238
 #define _DL_HWCAP_COUNT		64
c65238
@@ -68,7 +65,7 @@ static inline const char *
c65238
 __attribute__ ((unused))
c65238
 _dl_hwcap_string (int idx)
c65238
 {
c65238
-  return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
c65238
+  return GLRO(dl_powerpc_cap_flags)[idx];
c65238
 }
c65238
 
c65238
 static inline const char *
c65238
@@ -82,7 +79,7 @@ static inline int
c65238
 __attribute__ ((unused))
c65238
 _dl_string_hwcap (const char *str)
c65238
 {
c65238
-  for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
c65238
+  for (int i = 0; i < _DL_HWCAP_COUNT; ++i)
c65238
     if (strcmp (str, _dl_hwcap_string (i)) == 0)
c65238
       return i;
c65238
   return -1;
c65238
@@ -180,7 +177,7 @@ _dl_procinfo (unsigned int type, unsigned long int word)
c65238
     case AT_HWCAP:
c65238
       _dl_printf ("AT_HWCAP:       ");
c65238
 
c65238
-      for (int i = _DL_HWCAP_FIRST; i <= _DL_HWCAP_LAST; ++i)
c65238
+      for (int i = 0; i <= _DL_HWCAP_LAST; ++i)
c65238
        if (word & (1 << i))
c65238
          _dl_printf (" %s", _dl_hwcap_string (i));
c65238
       break;