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