00db10
This is a combination of two commits:
00db10
00db10
From 2d718ff7745d89dcc2a630fe72783acf109cadc0 Mon Sep 17 00:00:00 2001
00db10
From: "Ryan S. Arnold" <rsa@linux.vnet.ibm.com>
00db10
Date: Tue, 11 Jun 2013 09:32:41 -0500
00db10
Subject: [PATCH 33/42] PowerPC: Merge ports/ dl-procinfo.[ch] with base.
00db10
 (cherry picked from commit
00db10
 fac0c5f2b1dc0e1806cd95f2d6a4619929119f01)
00db10
00db10
From e0c595c971d958da58533a2b9b59f46a71a1e4cf Mon Sep 17 00:00:00 2001
00db10
From: "Ryan S. Arnold" <rsa@linux.vnet.ibm.com>
00db10
Date: Tue, 11 Jun 2013 09:33:33 -0500
00db10
Subject: [PATCH 34/42] PowerPC: Remove redundant
00db10
 ports/sysdeps/powerpc/dl-procinfo.[ch]. (cherry
00db10
 picked from commit
00db10
 d04310f210734448a5b950988d49dcea145df9c1)
00db10
00db10
diff -pruN glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.c glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.c
00db10
--- glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.c	2012-12-25 08:32:13.000000000 +0530
00db10
+++ glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.c	1970-01-01 05:30:00.000000000 +0530
00db10
@@ -1,96 +0,0 @@
00db10
-/* Data for processor capability information.  PowerPC version.
00db10
-   Copyright (C) 2005-2012 Free Software Foundation, Inc.
00db10
-   This file is part of the GNU C Library.
00db10
-
00db10
-   The GNU C Library is free software; you can redistribute it and/or
00db10
-   modify it under the terms of the GNU Lesser General Public
00db10
-   License as published by the Free Software Foundation; either
00db10
-   version 2.1 of the License, or (at your option) any later version.
00db10
-
00db10
-   The GNU C Library is distributed in the hope that it will be useful,
00db10
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
-   Lesser General Public License for more details.
00db10
-
00db10
-   You should have received a copy of the GNU Lesser General Public
00db10
-   License along with the GNU C Library.  If not, see
00db10
-   <http://www.gnu.org/licenses/>.  */
00db10
-
00db10
-/* This information must be kept in sync with the _DL_HWCAP_COUNT and
00db10
-   _DL_PLATFORM_COUNT definitions in procinfo.h.
00db10
-
00db10
-   If anything should be added here check whether the size of each string
00db10
-   is still ok with the given array size.
00db10
-
00db10
-   All the #ifdefs in the definitions are quite irritating but
00db10
-   necessary if we want to avoid duplicating the information.  There
00db10
-   are three different modes:
00db10
-
00db10
-   - PROCINFO_DECL is defined.  This means we are only interested in
00db10
-     declarations.
00db10
-
00db10
-   - PROCINFO_DECL is not defined:
00db10
-
00db10
-     + if SHARED is defined the file is included in an array
00db10
-       initializer.  The .element = { ... } syntax is needed.
00db10
-
00db10
-     + if SHARED is not defined a normal array initialization is
00db10
-       needed.
00db10
-  */
00db10
-
00db10
-#ifndef PROCINFO_CLASS
00db10
-# define PROCINFO_CLASS
00db10
-#endif
00db10
-
00db10
-#if !defined PROCINFO_DECL && defined SHARED
00db10
-  ._dl_powerpc_cap_flags
00db10
-#else
00db10
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[25][10]
00db10
-#endif
00db10
-#ifndef PROCINFO_DECL
00db10
-= {
00db10
-    "vsx",
00db10
-    "arch_2_06", "power6x", "dfp", "pa6t",
00db10
-    "arch_2_05", "ic_snoop", "smt", "booke",
00db10
-    "cellbe", "power5+", "power5", "power4",
00db10
-    "notb", "efpdouble", "efpsingle", "spe",
00db10
-    "ucache", "4xxmac", "mmu", "fpu",
00db10
-    "altivec", "ppc601", "ppc64", "ppc32",
00db10
-  }
00db10
-#endif
00db10
-#if !defined SHARED || defined PROCINFO_DECL
00db10
-;
00db10
-#else
00db10
-,
00db10
-#endif
00db10
-
00db10
-#if !defined PROCINFO_DECL && defined SHARED
00db10
-  ._dl_powerpc_platforms
00db10
-#else
00db10
-PROCINFO_CLASS const char _dl_powerpc_platforms[13][12]
00db10
-#endif
00db10
-#ifndef PROCINFO_DECL
00db10
-= {
00db10
-    [PPC_PLATFORM_POWER4] = "power4",
00db10
-    [PPC_PLATFORM_PPC970] = "ppc970",
00db10
-    [PPC_PLATFORM_POWER5] = "power5",
00db10
-    [PPC_PLATFORM_POWER5_PLUS] = "power5+",
00db10
-    [PPC_PLATFORM_POWER6] = "power6",
00db10
-    [PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
00db10
-    [PPC_PLATFORM_POWER6X] = "power6x",
00db10
-    [PPC_PLATFORM_POWER7] = "power7",
00db10
-    [PPC_PLATFORM_PPCA2] = "ppca2",
00db10
-    [PPC_PLATFORM_PPC405] = "ppc405",
00db10
-    [PPC_PLATFORM_PPC440] = "ppc440",
00db10
-    [PPC_PLATFORM_PPC464] = "ppc464",
00db10
-    [PPC_PLATFORM_PPC476] = "ppc476"
00db10
-  }
00db10
-#endif
00db10
-#if !defined SHARED || defined PROCINFO_DECL
00db10
-;
00db10
-#else
00db10
-,
00db10
-#endif
00db10
-
00db10
-#undef PROCINFO_DECL
00db10
-#undef PROCINFO_CLASS
00db10
diff -pruN glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.h glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.h
00db10
--- glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.h	2012-12-25 08:32:13.000000000 +0530
00db10
+++ glibc-2.17-c758a686/ports/sysdeps/powerpc/dl-procinfo.h	1970-01-01 05:30:00.000000000 +0530
00db10
@@ -1,172 +0,0 @@
00db10
-/* Processor capability information handling macros.  PowerPC version.
00db10
-   Copyright (C) 2005-2012 Free Software Foundation, Inc.
00db10
-   This file is part of the GNU C Library.
00db10
-
00db10
-   The GNU C Library is free software; you can redistribute it and/or
00db10
-   modify it under the terms of the GNU Lesser General Public
00db10
-   License as published by the Free Software Foundation; either
00db10
-   version 2.1 of the License, or (at your option) any later version.
00db10
-
00db10
-   The GNU C Library is distributed in the hope that it will be useful,
00db10
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
00db10
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00db10
-   Lesser General Public License for more details.
00db10
-
00db10
-   You should have received a copy of the GNU Lesser General Public
00db10
-   License along with the GNU C Library.  If not, see
00db10
-   <http://www.gnu.org/licenses/>.  */
00db10
-
00db10
-#ifndef _DL_PROCINFO_H
00db10
-#define _DL_PROCINFO_H 1
00db10
-
00db10
-#include <ldsodefs.h>
00db10
-#include <sysdep.h>            /* This defines the PPC_FEATURE_* macros.  */
00db10
-
00db10
-/* There are 25 bits used, but they are bits 7..31.  */
00db10
-#define _DL_HWCAP_FIRST                7
00db10
-#define _DL_HWCAP_COUNT                32
00db10
-
00db10
-/* These bits influence library search.  */
00db10
-#define HWCAP_IMPORTANT                (PPC_FEATURE_HAS_ALTIVEC \
00db10
-                               + PPC_FEATURE_HAS_DFP)
00db10
-
00db10
-#define _DL_PLATFORMS_COUNT    13
00db10
-
00db10
-#define _DL_FIRST_PLATFORM     32
00db10
-/* Mask to filter out platforms.  */
00db10
-#define _DL_HWCAP_PLATFORM      (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
00db10
-                               << _DL_FIRST_PLATFORM)
00db10
-
00db10
-/* Platform bits (relative to _DL_FIRST_PLATFORM).  */
00db10
-#define PPC_PLATFORM_POWER4          0
00db10
-#define PPC_PLATFORM_PPC970          1
00db10
-#define PPC_PLATFORM_POWER5          2
00db10
-#define PPC_PLATFORM_POWER5_PLUS      3
00db10
-#define PPC_PLATFORM_POWER6          4
00db10
-#define PPC_PLATFORM_CELL_BE         5
00db10
-#define PPC_PLATFORM_POWER6X         6
00db10
-#define PPC_PLATFORM_POWER7          7
00db10
-#define PPC_PLATFORM_PPCA2           8
00db10
-#define PPC_PLATFORM_PPC405          9
00db10
-#define PPC_PLATFORM_PPC440          10
00db10
-#define PPC_PLATFORM_PPC464          11
00db10
-#define PPC_PLATFORM_PPC476          12
00db10
-
00db10
-static inline const char *
00db10
-__attribute__ ((unused))
00db10
-_dl_hwcap_string (int idx)
00db10
-{
00db10
-  return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
00db10
-}
00db10
-
00db10
-static inline const char *
00db10
-__attribute__ ((unused))
00db10
-_dl_platform_string (int idx)
00db10
-{
00db10
-  return GLRO(dl_powerpc_platforms)[idx - _DL_FIRST_PLATFORM];
00db10
-}
00db10
-
00db10
-static inline int
00db10
-__attribute__ ((unused))
00db10
-_dl_string_hwcap (const char *str)
00db10
-{
00db10
-  for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
00db10
-    if (strcmp (str, _dl_hwcap_string (i)) == 0)
00db10
-      return i;
00db10
-  return -1;
00db10
-}
00db10
-
00db10
-static inline int
00db10
-__attribute__ ((unused, always_inline))
00db10
-_dl_string_platform (const char *str)
00db10
-{
00db10
-  if (str == NULL)
00db10
-    return -1;
00db10
-
00db10
-  if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_POWER4], 5) == 0)
00db10
-    {
00db10
-      int ret;
00db10
-      str += 5;
00db10
-      switch (*str)
00db10
-       {
00db10
-       case '4':
00db10
-         ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER4;
00db10
-         break;
00db10
-       case '5':
00db10
-         ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5;
00db10
-         if (str[1] == '+')
00db10
-           {
00db10
-             ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5_PLUS;
00db10
-             ++str;
00db10
-           }
00db10
-         break;
00db10
-       case '6':
00db10
-         ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6;
00db10
-         if (str[1] == 'x')
00db10
-           {
00db10
-             ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6X;
00db10
-             ++str;
00db10
-           }
00db10
-         break;
00db10
-       case '7':
00db10
-         ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER7;
00db10
-         break;
00db10
-       default:
00db10
-         return -1;
00db10
-       }
00db10
-      if (str[1] == '\0')
00db10
-       return ret;
00db10
-    }
00db10
-  else if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970],
00db10
-                   3) == 0)
00db10
-    {
00db10
-      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970]
00db10
-                          + 3) == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC970;
00db10
-      else if (strcmp (str + 3,
00db10
-                      GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3)
00db10
-              == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE;
00db10
-      else if (strcmp (str + 3,
00db10
-                      GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPCA2] + 3)
00db10
-              == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPCA2;
00db10
-      else if (strcmp (str + 3,
00db10
-                      GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC405] + 3)
00db10
-              == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC405;
00db10
-      else if (strcmp (str + 3,
00db10
-                      GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC440] + 3)
00db10
-              == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC440;
00db10
-      else if (strcmp (str + 3,
00db10
-                      GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC464] + 3)
00db10
-              == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC464;
00db10
-      else if (strcmp (str + 3,
00db10
-                      GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC476] + 3)
00db10
-              == 0)
00db10
-       return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC476;
00db10
-    }
00db10
-
00db10
-  return -1;
00db10
-}
00db10
-
00db10
-#ifdef IS_IN_rtld
00db10
-static inline int
00db10
-__attribute__ ((unused))
00db10
-_dl_procinfo (int word)
00db10
-{
00db10
-  _dl_printf ("AT_HWCAP:       ");
00db10
-
00db10
-  for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
00db10
-    if (word & (1 << i))
00db10
-      _dl_printf (" %s", _dl_hwcap_string (i));
00db10
-
00db10
-  _dl_printf ("\n");
00db10
-
00db10
-  return 0;
00db10
-}
00db10
-#endif
00db10
-
00db10
-#endif /* dl-procinfo.h */
00db10
diff -pruN glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.c glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.c
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.c	2012-12-25 08:32:13.000000000 +0530
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.c	2013-08-05 19:10:28.980541623 +0530
00db10
@@ -13,7 +13,7 @@
00db10
    Lesser General Public License for more details.
00db10
 
00db10
    You should have received a copy of the GNU Lesser General Public
00db10
-   License along with the GNU C Library; if not, see
00db10
+   License along with the GNU C Library.  If not, see
00db10
    <http://www.gnu.org/licenses/>.  */
00db10
 
00db10
 /* This information must be kept in sync with the _DL_HWCAP_COUNT and
00db10
@@ -67,7 +67,7 @@ PROCINFO_CLASS const char _dl_powerpc_ca
00db10
 #if !defined PROCINFO_DECL && defined SHARED
00db10
   ._dl_powerpc_platforms
00db10
 #else
00db10
-PROCINFO_CLASS const char _dl_powerpc_platforms[9][12]
00db10
+PROCINFO_CLASS const char _dl_powerpc_platforms[13][12]
00db10
 #endif
00db10
 #ifndef PROCINFO_DECL
00db10
 = {
00db10
@@ -79,7 +79,11 @@ PROCINFO_CLASS const char _dl_powerpc_pl
00db10
     [PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
00db10
     [PPC_PLATFORM_POWER6X] = "power6x",
00db10
     [PPC_PLATFORM_POWER7] = "power7",
00db10
-    [PPC_PLATFORM_PPCA2] = "ppca2"
00db10
+    [PPC_PLATFORM_PPCA2] = "ppca2",
00db10
+    [PPC_PLATFORM_PPC405] = "ppc405",
00db10
+    [PPC_PLATFORM_PPC440] = "ppc440",
00db10
+    [PPC_PLATFORM_PPC464] = "ppc464",
00db10
+    [PPC_PLATFORM_PPC476] = "ppc476"
00db10
   }
00db10
 #endif
00db10
 #if !defined SHARED || defined PROCINFO_DECL
00db10
diff -pruN glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h
00db10
--- glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h	2012-12-25 08:32:13.000000000 +0530
00db10
+++ glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h	2013-08-05 19:10:28.990541622 +0530
00db10
@@ -13,14 +13,14 @@
00db10
    Lesser General Public License for more details.
00db10
 
00db10
    You should have received a copy of the GNU Lesser General Public
00db10
-   License along with the GNU C Library; if not, see
00db10
+   License along with the GNU C Library.  If not, see
00db10
    <http://www.gnu.org/licenses/>.  */
00db10
 
00db10
 #ifndef _DL_PROCINFO_H
00db10
-#define _DL_PROCINFO_H	1
00db10
+#define _DL_PROCINFO_H 1
00db10
 
00db10
 #include <ldsodefs.h>
00db10
-#include <sysdep.h>		/* This defines the PPC_FEATURE_* macros.  */
00db10
+#include <sysdep.h>	/* This defines the PPC_FEATURE_* macros.  */
00db10
 
00db10
 /* There are 25 bits used, but they are bits 7..31.  */
00db10
 #define _DL_HWCAP_FIRST		7
00db10
@@ -30,12 +30,12 @@
00db10
 #define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC \
00db10
 				+ PPC_FEATURE_HAS_DFP)
00db10
 
00db10
-#define _DL_PLATFORMS_COUNT	9
00db10
+#define _DL_PLATFORMS_COUNT	13
00db10
 
00db10
-#define _DL_FIRST_PLATFORM      32
00db10
+#define _DL_FIRST_PLATFORM	32
00db10
 /* Mask to filter out platforms.  */
00db10
-#define _DL_HWCAP_PLATFORM      (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
00db10
-                                 << _DL_FIRST_PLATFORM)
00db10
+#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
00db10
+				<< _DL_FIRST_PLATFORM)
00db10
 
00db10
 /* Platform bits (relative to _DL_FIRST_PLATFORM).  */
00db10
 #define PPC_PLATFORM_POWER4		0
00db10
@@ -47,6 +47,10 @@
00db10
 #define PPC_PLATFORM_POWER6X		6
00db10
 #define PPC_PLATFORM_POWER7		7
00db10
 #define PPC_PLATFORM_PPCA2		8
00db10
+#define PPC_PLATFORM_PPC405		9
00db10
+#define PPC_PLATFORM_PPC440		10
00db10
+#define PPC_PLATFORM_PPC464		11
00db10
+#define PPC_PLATFORM_PPC476		12
00db10
 
00db10
 static inline const char *
00db10
 __attribute__ ((unused))
00db10
@@ -111,7 +115,7 @@ _dl_string_platform (const char *str)
00db10
 	  return -1;
00db10
 	}
00db10
       if (str[1] == '\0')
00db10
-	return ret;
00db10
+       return ret;
00db10
     }
00db10
   else if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970],
00db10
 		    3) == 0)
00db10
@@ -127,6 +131,22 @@ _dl_string_platform (const char *str)
00db10
 		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPCA2] + 3)
00db10
 	       == 0)
00db10
 	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPCA2;
00db10
+      else if (strcmp (str + 3,
00db10
+		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC405] + 3)
00db10
+	       == 0)
00db10
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC405;
00db10
+      else if (strcmp (str + 3,
00db10
+		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC440] + 3)
00db10
+	       == 0)
00db10
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC440;
00db10
+      else if (strcmp (str + 3,
00db10
+		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC464] + 3)
00db10
+	       == 0)
00db10
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC464;
00db10
+      else if (strcmp (str + 3,
00db10
+		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC476] + 3)
00db10
+	       == 0)
00db10
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC476;
00db10
     }
00db10
 
00db10
   return -1;