]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add GLRO(dl_hwcap2), conditional on per platform HWCAP2_AVAIL. rsa/hwcap2_v5
authorRyan S. Arnold <rsa@linux.vnet.ibm.com>
Thu, 27 Jun 2013 20:48:35 +0000 (15:48 -0500)
committerRyan S. Arnold <rsa@linux.vnet.ibm.com>
Thu, 27 Jun 2013 20:48:35 +0000 (15:48 -0500)
16 files changed:
ChangeLog
elf/dl-support.c
elf/dl-sysdep.c
misc/getauxval.c
ports/sysdeps/alpha/dl-procinfo.h
ports/sysdeps/mips/dl-procinfo.h
ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
sysdeps/generic/dl-hwcap2.h [new file with mode: 0644]
sysdeps/generic/dl-procinfo.h
sysdeps/generic/ldsodefs.h
sysdeps/i386/dl-procinfo.h
sysdeps/powerpc/dl-procinfo.h
sysdeps/s390/dl-procinfo.h
sysdeps/sparc/dl-procinfo.h
sysdeps/unix/sysv/linux/i386/dl-procinfo.h
sysdeps/unix/sysv/linux/s390/dl-procinfo.h

index 1012b2c2dbf8a329bf47f6832a15d047716bf3f9..ff00d1e62de1784adb286e30cb5fdffc59ff915b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2013-06-27  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
+
+       * elf/dl-support.c (_dl_hwcap2): Add a new hwcap field for more
+       hardware capabilities, conditional on HWCAP2_AVAIL.
+       (_dl_aux_init): Read AT_HWCAP2 into GLRO(dl_hwcap2), conditional on
+       HWCAP2_AVAIL.
+       * elf/dl-sysdep.c (_dl_sysdep_start): Read AT_HWCAP2 into
+       GLRO(dl_hwcap2), conditional on HWCAP2_AVAIL.
+       (_dl_show_auxv): Add support for calling _dl_procinfo when AT_HWCAP2
+       is encountered conditional on HWCAP2_AVAIL such that the default
+       mechanism is used otherwise.
+       * misc/getauxval.c (__getauxval): Return GLRO(dl_hwcap2) on AT_HWCAP2,
+       conditional on HWCAP2_AVAIL.
+       * sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_hwcap2 as a new
+       struct member, conditional on HWCAP2_AVAIL.
+       * sysdeps/generic/dl-hwcap2.h: New file defining HWCAP2_AVAIL as 0.
+       * ports/sysdeps/alpha/dl-procinfo.h (_dl_procinfo): Add TYPE parameter
+       to macro prototype for AT_HWCAP2 support.
+       * ports/sysdeps/mips/dl-procinfo.h: Likewise.
+       * sysdeps/generic/dl-procinfo.h: Likewise.
+       * sysdeps/i386/dl-procinfo.h: Likewise.
+       * sysdeps/s390/dl-procinfo.h: Likewise.
+       * ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo): Add
+       TYPE parameter to macro prototype for AT_HWCAP2 support.  Make WORD
+       unsigned long int rather than signed int.  Stub in case for TYPE ==
+       AT_HWCAP2.
+       * sysdeps/powerpc/dl-procinfo.h: Likewise.
+       * sysdeps/sparc/dl-procinfo.h: Likewise.
+       * sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Likewise.
+       * sysdeps/unix/sysv/linux/s390/dl-procinfo.h: Likewise.
+
 2013-06-26  Joseph Myers  <joseph@codesourcery.com>
 
        * configure.in (CC): Require GCC version 4.4 or later.
index b3ab9560ad75bf367f8368de3511bbe5d1e4b2f9..94d35e94e22c33ca14ab32e54a9560b4f59a7d6e 100644 (file)
@@ -31,6 +31,7 @@
 #include <dl-cache.h>
 #include <dl-librecon.h>
 #include <dl-procinfo.h>
+#include <dl-hwcap2.h>
 #include <unsecvars.h>
 #include <hp-timing.h>
 #include <stackinfo.h>
@@ -131,6 +132,10 @@ const ElfW(Phdr) *_dl_phdr;
 size_t _dl_phnum;
 uint64_t _dl_hwcap __attribute__ ((nocommon));
 
+#if HWCAP2_AVAIL
+uint64_t _dl_hwcap2 __attribute__ ((nocommon));
+#endif
+
 /* This is not initialized to HWCAP_IMPORTANT, matching the definition
    of _dl_important_hwcaps, below, where no hwcap strings are ever
    used.  This mask is still used to mediate the lookups in the cache
@@ -214,6 +219,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
       case AT_HWCAP:
        GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
        break;
+#if HWCAP2_AVAIL
+      case AT_HWCAP2:
+       GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
+       break;
+#endif
 #ifdef NEED_DL_SYSINFO
       case AT_SYSINFO:
        GL(dl_sysinfo) = av->a_un.a_val;
index 52de23f44b1bd37938cbb078f23eaa000a591892..50d84a0f497529d4aa3950e91a7c98a3803c5f8e 100644 (file)
@@ -43,6 +43,7 @@
 #include <dl-osinfo.h>
 #include <hp-timing.h>
 #include <tls.h>
+#include <dl-hwcap2.h>
 
 extern char **_environ attribute_hidden;
 extern char _end[] attribute_hidden;
@@ -156,6 +157,11 @@ _dl_sysdep_start (void **start_argptr,
       case AT_HWCAP:
        GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
        break;
+#if HWCAP2_AVAIL
+      case AT_HWCAP2:
+       GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
+       break;
+#endif
       case AT_CLKTCK:
        GLRO(dl_clktck) = av->a_un.a_val;
        break;
@@ -303,6 +309,7 @@ _dl_show_auxv (void)
          [AT_SYSINFO - 2] =            { "SYSINFO:      0x", hex },
          [AT_SYSINFO_EHDR - 2] =       { "SYSINFO_EHDR: 0x", hex },
          [AT_RANDOM - 2] =             { "RANDOM:       0x", hex },
+         [AT_HWCAP2 - 2] =             { "HWCAP2:       0x", hex },
        };
       unsigned int idx = (unsigned int) (av->a_type - 2);
 
@@ -314,10 +321,14 @@ _dl_show_auxv (void)
       assert (AT_NULL == 0);
       assert (AT_IGNORE == 1);
 
+#if HWCAP2_AVAIL
+      if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2)
+#else
       if (av->a_type == AT_HWCAP)
+#endif
        {
-         /* This is handled special.  */
-         if (_dl_procinfo (av->a_un.a_val) == 0)
+         /* These are handled in a special way per platform.  */
+         if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0)
            continue;
        }
 
index 4321e3718a8492214ebd9cfa2cfc359b815b293b..81474eebc9fcd93de3f27a32113693dfd47503bb 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <sys/auxv.h>
 #include <ldsodefs.h>
-
+#include <dl-hwcap2.h>
 
 unsigned long int
 __getauxval (unsigned long int type)
@@ -26,6 +26,10 @@ __getauxval (unsigned long int type)
 
   if (type == AT_HWCAP)
     return GLRO(dl_hwcap);
+#if HWCAP2_AVAIL
+  else if (type == AT_HWCAP2)
+    return GLRO(dl_hwcap2);
+#endif
 
   for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
     if (p->a_type == type)
index 523d9667613b156bd2901c9f1fa82d9a80f32923..0344dbc968f294dcce382519e8588fd9c20e60d3 100644 (file)
@@ -51,7 +51,7 @@ _dl_string_platform (const char *str)
 };
 
 /* We cannot provide a general printing function.  */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
 
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
index 5cc9a44446eb12f0eb504e13f2b16674fb450eb5..e96550c402f5955ec6f2aa9847c11cc2b84e9854 100644 (file)
@@ -51,7 +51,7 @@ _dl_string_platform (const char *str)
 };
 
 /* We cannot provide a general printing function.  */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
 
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
index 161e86c796462cce4cc592c3b8039bbf65eb2bfb..132ca4ffa234744ee2a1cec8c3fef229d61a93bc 100644 (file)
 
 static inline int
 __attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned long int word)
 {
   int i;
 
+  /* Handle in a more sophisticated manner if HWCAP2 is supported.  */
+  if (type == AT_HWCAP2)
+    return 0;
+
   _dl_printf ("AT_HWCAP:   ");
 
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
diff --git a/sysdeps/generic/dl-hwcap2.h b/sysdeps/generic/dl-hwcap2.h
new file mode 100644 (file)
index 0000000..cd6fdf9
--- /dev/null
@@ -0,0 +1,25 @@
+/* HWCAP2 Availability Test
+   Copyright (C) 1998-2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _HWCAP2_H
+#define _HWCAP2_H      1
+
+/* Default to unavailable.  */
+#define HWCAP2_AVAIL           (0)
+
+#endif /* dl-hwcap2.h */
index 90c87d942a26975dd390a806cae14db21cfa6f94..a184a5918a34fc741b38b62df0d8af462cc997dd 100644 (file)
@@ -21,7 +21,7 @@
 #define _DL_PROCINFO_H 1
 
 /* We cannot provide a general printing function.  */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
 
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
index cb172042597b2f0f9890daeecba44dca05b39c87..edb6efdfe4bef4f7219db143abba8f4117bc1142 100644 (file)
@@ -408,6 +408,7 @@ struct rtld_global
     size_t count;
     void *list[50];
   } *_dl_scope_free_list;
+
 #ifdef SHARED
 };
 # define __rtld_global_attribute__
@@ -554,6 +555,14 @@ struct rtld_global_ro
   EXTERN struct link_map *_dl_sysinfo_map;
 #endif
 
+#include <dl-hwcap2.h>
+
+#if HWCAP2_AVAIL
+  /* Mask for more hardware capabilities that are available on some
+     platforms.  */
+  EXTERN uint64_t _dl_hwcap2;
+#endif
+
 #ifdef SHARED
   /* We add a function table to _rtld_global which is then used to
      call the function instead of going through the PLT.  The result
index 883fa7f0abc8ff6f285de2a2220e3233379cb9f5..233a3257e3a93d493e29b19ad9f53f131a9e3e3c 100644 (file)
@@ -61,7 +61,7 @@ enum
 };
 
 /* We cannot provide a general printing function.  */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
 
 static inline const char *
 __attribute__ ((unused))
index 1c978ba62dbbe3049d15f7a941ca96f2d85d94e5..73cd2799ddad5f527835981af50b3e07d6621d6b 100644 (file)
@@ -159,8 +159,12 @@ _dl_string_platform (const char *str)
 #ifdef IS_IN_rtld
 static inline int
 __attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned long int word)
 {
+  /* Handle in a more sophisticated manner if HWCAP2 is supported.  */
+  if (type == AT_HWCAP2)
+    return 0;
+
   _dl_printf ("AT_HWCAP:       ");
 
   for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
index 717f6f9a50807c612e58201a037155af14f3b9bb..45e27f1023d1e9088ea225436a669ed6f411eba1 100644 (file)
@@ -56,7 +56,7 @@ enum
                          | HWCAP_S390_EIMM | HWCAP_S390_DFP)
 
 /* We cannot provide a general printing function.  */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
 
 static inline const char *
 __attribute__ ((unused))
index a18b099586f8d9fdf615f17fe11f3adaf9126f89..35065c437123b2d03822817bc2e5daa8df4df573 100644 (file)
 
 static inline int
 __attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned long int word)
 {
   int i;
 
+  /* Handle in a more sophisticated manner if HWCAP2 is supported.  */
+  if (type == AT_HWCAP2)
+    return 0;
+
   _dl_printf ("AT_HWCAP:   ");
 
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
index a82f8f5b8d45c8d2e17de86cad5c1e5c796c270d..17d87aba11d13b8244ca3a722ddc72e8753b0123 100644 (file)
 #undef _dl_procinfo
 static inline int
 __attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned long int word)
 {
   /* This table should match the information from arch/i386/kernel/setup.c
      in the kernel sources.  */
   int i;
 
+  /* Handle in a more sophisticated manner if HWCAP2 is supported.  */
+  if (type == AT_HWCAP2)
+    return 0;
+
   _dl_printf ("AT_HWCAP:   ");
 
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)
index 5ca4b76ca72527cf57412b8acdf8fac7f1e31840..f4a36e0b603901739ccd06552e9d930cb2e678f1 100644 (file)
 #undef _dl_procinfo
 static inline int
 __attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned long int word)
 {
   /* This table should match the information from arch/s390/kernel/setup.c
      in the kernel sources.  */
   int i;
 
+  /* Handle in a more sophisticated manner if HWCAP2 is supported.  */
+  if (type == AT_HWCAP2)
+    return 0;
+
   _dl_printf ("AT_HWCAP:   ");
 
   for (i = 0; i < _DL_HWCAP_COUNT; ++i)