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