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