Blame SOURCES/glibc-rh731833-hwcap-4.patch

147e83
From dfb57bf8871503967f23f9ce4bf17479a19cf8e4 Mon Sep 17 00:00:00 2001
147e83
From: "Ryan S. Arnold" <rsa@linux.vnet.ibm.com>
147e83
Date: Fri, 28 Jun 2013 16:50:48 -0500
147e83
Subject: [PATCH 39/42] Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type.
147e83
 (cherry picked from commit
147e83
 1ae8bfe07c1ab2444cc1d186321ff1431a1b9f96)
147e83
147e83
---
147e83
 elf/dl-support.c                                |  4 ++++
147e83
 elf/dl-sysdep.c                                 | 10 +++++++---
147e83
 misc/getauxval.c                                |  2 ++
147e83
 ports/sysdeps/alpha/dl-procinfo.h               |  2 +-
147e83
 ports/sysdeps/mips/dl-procinfo.h                |  2 +-
147e83
 ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h |  6 +++++-
147e83
 sysdeps/generic/dl-procinfo.h                   |  2 +-
147e83
 sysdeps/generic/ldsodefs.h                      |  4 ++++
147e83
 sysdeps/i386/dl-procinfo.h                      |  2 +-
147e83
 sysdeps/powerpc/dl-procinfo.h                   |  6 +++++-
147e83
 sysdeps/s390/dl-procinfo.h                      |  2 +-
147e83
 sysdeps/sparc/dl-procinfo.h                     |  6 +++++-
147e83
 sysdeps/unix/sysv/linux/i386/dl-procinfo.h      |  6 +++++-
147e83
 sysdeps/unix/sysv/linux/s390/dl-procinfo.h      |  6 +++++-
147e83
 18 files changed, 89 insertions(+), 13 deletions(-)
147e83
147e83
diff --git glibc-2.17-c758a686/elf/dl-support.c glibc-2.17-c758a686/elf/dl-support.c
147e83
index 81e7172..05f53ee 100644
147e83
--- glibc-2.17-c758a686/elf/dl-support.c
147e83
+++ glibc-2.17-c758a686/elf/dl-support.c
147e83
@@ -129,6 +129,7 @@ ElfW(auxv_t) *_dl_auxv;
147e83
 ElfW(Phdr) *_dl_phdr;
147e83
 size_t _dl_phnum;
147e83
 uint64_t _dl_hwcap __attribute__ ((nocommon));
147e83
+uint64_t _dl_hwcap2 __attribute__ ((nocommon));
147e83
 
147e83
 /* This is not initialized to HWCAP_IMPORTANT, matching the definition
147e83
    of _dl_important_hwcaps, below, where no hwcap strings are ever
147e83
@@ -212,6 +213,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
147e83
       case AT_HWCAP:
147e83
 	GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
147e83
 	break;
147e83
+      case AT_HWCAP2:
147e83
+	GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
147e83
+	break;
147e83
 #ifdef NEED_DL_SYSINFO
147e83
       case AT_SYSINFO:
147e83
 	GL(dl_sysinfo) = av->a_un.a_val;
147e83
diff --git glibc-2.17-c758a686/elf/dl-sysdep.c glibc-2.17-c758a686/elf/dl-sysdep.c
147e83
index 65a9046..a0d1d04 100644
147e83
--- glibc-2.17-c758a686/elf/dl-sysdep.c
147e83
+++ glibc-2.17-c758a686/elf/dl-sysdep.c
147e83
@@ -156,6 +156,9 @@ _dl_sysdep_start (void **start_argptr,
147e83
       case AT_HWCAP:
147e83
 	GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
147e83
 	break;
147e83
+      case AT_HWCAP2:
147e83
+	GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
147e83
+	break;
147e83
       case AT_CLKTCK:
147e83
 	GLRO(dl_clktck) = av->a_un.a_val;
147e83
 	break;
147e83
@@ -298,6 +301,7 @@ _dl_show_auxv (void)
147e83
 	  [AT_SYSINFO - 2] =		{ "SYSINFO:      0x", hex },
147e83
 	  [AT_SYSINFO_EHDR - 2] =	{ "SYSINFO_EHDR: 0x", hex },
147e83
 	  [AT_RANDOM - 2] =		{ "RANDOM:       0x", hex },
147e83
+	  [AT_HWCAP2 - 2] =		{ "HWCAP2:       0x", hex },
147e83
 	};
147e83
       unsigned int idx = (unsigned int) (av->a_type - 2);
147e83
 
147e83
@@ -309,10 +313,10 @@ _dl_show_auxv (void)
147e83
       assert (AT_NULL == 0);
147e83
       assert (AT_IGNORE == 1);
147e83
 
147e83
-      if (av->a_type == AT_HWCAP)
147e83
+      if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2)
147e83
 	{
147e83
-	  /* This is handled special.  */
147e83
-	  if (_dl_procinfo (av->a_un.a_val) == 0)
147e83
+	  /* These are handled in a special way per platform.  */
147e83
+	  if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0)
147e83
 	    continue;
147e83
 	}
147e83
 
147e83
diff --git glibc-2.17-c758a686/misc/getauxval.c glibc-2.17-c758a686/misc/getauxval.c
147e83
index bff4560..1c1882b 100644
147e83
--- glibc-2.17-c758a686/misc/getauxval.c
147e83
+++ glibc-2.17-c758a686/misc/getauxval.c
147e83
@@ -26,6 +26,8 @@ __getauxval (unsigned long int type)
147e83
 
147e83
   if (type == AT_HWCAP)
147e83
     return GLRO(dl_hwcap);
147e83
+  else if (type == AT_HWCAP2)
147e83
+    return GLRO(dl_hwcap2);
147e83
 
147e83
   for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
147e83
     if (p->a_type == type)
147e83
diff --git glibc-2.17-c758a686/ports/sysdeps/alpha/dl-procinfo.h glibc-2.17-c758a686/ports/sysdeps/alpha/dl-procinfo.h
147e83
index 3db0efb..c3b27b4 100644
147e83
--- glibc-2.17-c758a686/ports/sysdeps/alpha/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/ports/sysdeps/alpha/dl-procinfo.h
147e83
@@ -51,7 +51,7 @@ _dl_string_platform (const char *str)
147e83
 };
147e83
 
147e83
 /* We cannot provide a general printing function.  */
147e83
-#define _dl_procinfo(word) -1
147e83
+#define _dl_procinfo(type, word) -1
147e83
 
147e83
 /* There are no hardware capabilities defined.  */
147e83
 #define _dl_hwcap_string(idx) ""
147e83
diff --git glibc-2.17-c758a686/ports/sysdeps/mips/dl-procinfo.h glibc-2.17-c758a686/ports/sysdeps/mips/dl-procinfo.h
147e83
index d42aea7..8c9f5c2 100644
147e83
--- glibc-2.17-c758a686/ports/sysdeps/mips/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/ports/sysdeps/mips/dl-procinfo.h
147e83
@@ -51,7 +51,7 @@ _dl_string_platform (const char *str)
147e83
 };
147e83
 
147e83
 /* We cannot provide a general printing function.  */
147e83
-#define _dl_procinfo(word) -1
147e83
+#define _dl_procinfo(type, word) -1
147e83
 
147e83
 /* There are no hardware capabilities defined.  */
147e83
 #define _dl_hwcap_string(idx) ""
147e83
diff --git glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
147e83
index bea7100..c96297b 100644
147e83
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
147e83
@@ -31,10 +31,14 @@
147e83
 
147e83
 static inline int
147e83
 __attribute__ ((unused))
147e83
-_dl_procinfo (int word)
147e83
+_dl_procinfo (unsigned int type, unsigned long int word)
147e83
 {
147e83
   int i;
147e83
 
147e83
+  /* Fallback to unknown output mechanism.  */
147e83
+  if (type == AT_HWCAP2)
147e83
+    return -1;
147e83
+
147e83
   _dl_printf ("AT_HWCAP:   ");
147e83
 
147e83
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
147e83
diff --git glibc-2.17-c758a686/sysdeps/generic/dl-procinfo.h glibc-2.17-c758a686/sysdeps/generic/dl-procinfo.h
147e83
index c2bf914..0345717 100644
147e83
--- glibc-2.17-c758a686/sysdeps/generic/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/generic/dl-procinfo.h
147e83
@@ -21,7 +21,7 @@
147e83
 #define _DL_PROCINFO_H	1
147e83
 
147e83
 /* We cannot provide a general printing function.  */
147e83
-#define _dl_procinfo(word) -1
147e83
+#define _dl_procinfo(type, word) -1
147e83
 
147e83
 /* There are no hardware capabilities defined.  */
147e83
 #define _dl_hwcap_string(idx) ""
147e83
diff --git glibc-2.17-c758a686/sysdeps/generic/ldsodefs.h glibc-2.17-c758a686/sysdeps/generic/ldsodefs.h
147e83
index c667e34..5635d72 100644
147e83
--- glibc-2.17-c758a686/sysdeps/generic/ldsodefs.h
147e83
+++ glibc-2.17-c758a686/sysdeps/generic/ldsodefs.h
147e83
@@ -548,6 +548,10 @@ struct rtld_global_ro
147e83
   EXTERN struct link_map *_dl_sysinfo_map;
147e83
 #endif
147e83
 
147e83
+  /* Mask for more hardware capabilities that are available on some
147e83
+     platforms.  */
147e83
+  EXTERN uint64_t _dl_hwcap2;
147e83
+
147e83
 #ifdef SHARED
147e83
   /* We add a function table to _rtld_global which is then used to
147e83
      call the function instead of going through the PLT.  The result
147e83
diff --git glibc-2.17-c758a686/sysdeps/i386/dl-procinfo.h glibc-2.17-c758a686/sysdeps/i386/dl-procinfo.h
147e83
index 6ecaac2..38e902d 100644
147e83
--- glibc-2.17-c758a686/sysdeps/i386/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/i386/dl-procinfo.h
147e83
@@ -61,7 +61,7 @@ enum
147e83
 };
147e83
 
147e83
 /* We cannot provide a general printing function.  */
147e83
-#define _dl_procinfo(word) -1
147e83
+#define _dl_procinfo(type, word) -1
147e83
 
147e83
 static inline const char *
147e83
 __attribute__ ((unused))
147e83
diff --git glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h
147e83
index 0939dcf..7732ed2 100644
147e83
--- glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/powerpc/dl-procinfo.h
147e83
@@ -159,8 +159,12 @@ _dl_string_platform (const char *str)
147e83
 #ifdef IS_IN_rtld
147e83
 static inline int
147e83
 __attribute__ ((unused))
147e83
-_dl_procinfo (int word)
147e83
+_dl_procinfo (unsigned int type, unsigned long int word)
147e83
 {
147e83
+  /* Fallback to unknown output mechanism.  */
147e83
+  if (type == AT_HWCAP2)
147e83
+    return -1;
147e83
+
147e83
   _dl_printf ("AT_HWCAP:       ");
147e83
 
147e83
   for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
147e83
diff --git glibc-2.17-c758a686/sysdeps/s390/dl-procinfo.h glibc-2.17-c758a686/sysdeps/s390/dl-procinfo.h
147e83
index 97dcf07..26de043 100644
147e83
--- glibc-2.17-c758a686/sysdeps/s390/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/s390/dl-procinfo.h
147e83
@@ -56,7 +56,7 @@ enum
147e83
 			  | HWCAP_S390_EIMM | HWCAP_S390_DFP)
147e83
 
147e83
 /* We cannot provide a general printing function.  */
147e83
-#define _dl_procinfo(word) -1
147e83
+#define _dl_procinfo(type, word) -1
147e83
 
147e83
 static inline const char *
147e83
 __attribute__ ((unused))
147e83
diff --git glibc-2.17-c758a686/sysdeps/sparc/dl-procinfo.h glibc-2.17-c758a686/sysdeps/sparc/dl-procinfo.h
147e83
index 6ae8768..a05d458 100644
147e83
--- glibc-2.17-c758a686/sysdeps/sparc/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/sparc/dl-procinfo.h
147e83
@@ -28,10 +28,14 @@
147e83
 
147e83
 static inline int
147e83
 __attribute__ ((unused))
147e83
-_dl_procinfo (int word)
147e83
+_dl_procinfo (unsigned int type, unsigned long int word)
147e83
 {
147e83
   int i;
147e83
 
147e83
+  /* Fallback to unknown output mechanism.  */
147e83
+  if (type == AT_HWCAP2)
147e83
+    return -1;
147e83
+
147e83
   _dl_printf ("AT_HWCAP:   ");
147e83
 
147e83
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
147e83
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/i386/dl-procinfo.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
147e83
index 4c61357..23f4501 100644
147e83
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
147e83
@@ -24,12 +24,16 @@
147e83
 #undef _dl_procinfo
147e83
 static inline int
147e83
 __attribute__ ((unused))
147e83
-_dl_procinfo (int word)
147e83
+_dl_procinfo (unsigned int type, unsigned long int word)
147e83
 {
147e83
   /* This table should match the information from arch/i386/kernel/setup.c
147e83
      in the kernel sources.  */
147e83
   int i;
147e83
 
147e83
+  /* Fallback to unknown output mechanism.  */
147e83
+  if (type == AT_HWCAP2)
147e83
+    return -1;
147e83
+
147e83
   _dl_printf ("AT_HWCAP:   ");
147e83
 
147e83
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
147e83
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/dl-procinfo.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
147e83
index f36ba55..759738e 100644
147e83
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
147e83
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/dl-procinfo.h
147e83
@@ -24,12 +24,16 @@
147e83
 #undef _dl_procinfo
147e83
 static inline int
147e83
 __attribute__ ((unused))
147e83
-_dl_procinfo (int word)
147e83
+_dl_procinfo (unsigned int type, unsigned long int word)
147e83
 {
147e83
   /* This table should match the information from arch/s390/kernel/setup.c
147e83
      in the kernel sources.  */
147e83
   int i;
147e83
 
147e83
+  /* Fallback to unknown output mechanism.  */
147e83
+  if (type == AT_HWCAP2)
147e83
+    return -1;
147e83
+
147e83
   _dl_printf ("AT_HWCAP:   ");
147e83
 
147e83
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
147e83
-- 
147e83
1.7.11.7
147e83