about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rw-r--r--elf/dl-support.c2
-rw-r--r--elf/dl-sysdep.c9
-rw-r--r--manual/startup.texi30
-rw-r--r--misc/Makefile4
-rw-r--r--misc/Versions3
-rw-r--r--misc/getauxval.c36
-rw-r--r--misc/sys/auxv.h35
-rw-r--r--sysdeps/generic/bits/hwcap.h23
-rw-r--r--sysdeps/generic/ldsodefs.h3
-rw-r--r--sysdeps/powerpc/bits/hwcap.h53
-rw-r--r--sysdeps/powerpc/sysdep.h29
-rw-r--r--sysdeps/sparc/bits/hwcap.h47
-rw-r--r--sysdeps/sparc/sysdep.h29
-rw-r--r--sysdeps/unix/sysv/linux/i386/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/hwcap.h36
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sh/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist2
24 files changed, 326 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index a428760af2..49e615761e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2012-05-20  Richard Henderson  <rth@twiddle.net>
+
+	* misc/getauxval.c: New file.
+	* misc/sys/auxv.h: New file.
+	* misc/Makefile (headers): Add sys/auxv.h, bits/hwcap.h.
+	(routines): Add getauxval.
+	* misc/Versions (GLIBC_2.16): Add __getauxval, getauxval.
+	* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Add _dl_auxv.
+	* elf/dl-sysdep.c (_dl_auxv): Remove.
+	(_dl_sysdep_start, _dl_show_auxv): Use GLRO to access _dl_auxv.
+	* elf/dl-support.c (_dl_auxv): New variable.
+	(_dl_aux_init): Initialize it.
+	* manual/startup.texi (Auxiliary Vector): New node.
+	* sysdeps/generic/bits/hwcap.h: New file.
+	* sysdeps/powerpc/bits/hwcap.h: New file, split out from ...
+	* sysdeps/powerpc/sysdep.h: ... here.  Include it.
+	* sysdeps/sparc/bits/hwcap.h: New file, split out from ...
+	* sysdeps/sparc/sysdep.h: ... here.  Include it.
+	* sysdeps/unix/sysv/linux/s390/bits/hwcap.h: New file.
+	* sysdeps/unix/sysv/linux/i386/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/sh/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist: Update.
+	* sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist: Update.
+
 2012-05-19  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
diff --git a/elf/dl-support.c b/elf/dl-support.c
index a0f2122071..2bb468a5fb 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -125,6 +125,7 @@ int _dl_debug_fd = STDERR_FILENO;
 
 int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID;
 
+ElfW(auxv_t) *_dl_auxv;
 ElfW(Phdr) *_dl_phdr;
 size_t _dl_phnum;
 uint64_t _dl_hwcap __attribute__ ((nocommon));
@@ -187,6 +188,7 @@ _dl_aux_init (ElfW(auxv_t) *av)
   uid_t uid = 0;
   gid_t gid = 0;
 
+  _dl_auxv = av;
   for (; av->a_type != AT_NULL; ++av)
     switch (av->a_type)
       {
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index ea505a646f..e2a9d935ab 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -61,7 +61,6 @@ int __libc_multiple_libcs = 0;	/* Defining this here avoids the inclusion
 /* This variable contains the lowest stack address ever used.  */
 void *__libc_stack_end attribute_relro = NULL;
 rtld_hidden_data_def(__libc_stack_end)
-static ElfW(auxv_t) *_dl_auxv attribute_relro;
 void *_dl_random attribute_relro = NULL;
 
 #ifndef DL_FIND_ARG_COMPONENTS
@@ -111,12 +110,12 @@ _dl_sysdep_start (void **start_argptr,
 
   __libc_stack_end = DL_STACK_END (start_argptr);
   DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ,
-			  _dl_auxv);
+			  GLRO(dl_auxv));
 
   user_entry = (ElfW(Addr)) ENTRY_POINT;
   GLRO(dl_platform) = NULL; /* Default to nothing known about the platform.  */
 
-  for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++))
+  for (av = GLRO(dl_auxv); av->a_type != AT_NULL; set_seen (av++))
     switch (av->a_type)
       {
       case AT_PHDR:
@@ -240,7 +239,7 @@ _dl_sysdep_start (void **start_argptr,
   if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
     __libc_check_standard_fds ();
 
-  (*dl_main) (phdr, phnum, &user_entry, _dl_auxv);
+  (*dl_main) (phdr, phnum, &user_entry, GLRO(dl_auxv));
   return user_entry;
 }
 
@@ -265,7 +264,7 @@ _dl_show_auxv (void)
      close by (otherwise the array will be too large).  In case we have
      to support a platform where these requirements are not fulfilled
      some alternative implementation has to be used.  */
-  for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
+  for (av = GLRO(dl_auxv); av->a_type != AT_NULL; ++av)
     {
       static const struct
       {
diff --git a/manual/startup.texi b/manual/startup.texi
index ed75e7bdc3..0420e93289 100644
--- a/manual/startup.texi
+++ b/manual/startup.texi
@@ -34,8 +34,9 @@ This chapter looks at program startup from the execee's point of view.  To
 see the event from the execor's point of view, see @ref{Executing a File}.
 
 @menu
-* Program Arguments::           Parsing your program's command-line arguments.
+* Program Arguments::           Parsing your program's command-line arguments
 * Environment Variables::       Less direct parameters affecting your program
+* Auxiliary Vector::            Least direct parameters affecting your program
 * System Calls::                Requesting service from the system
 * Program Termination::         Telling the system you're done; return status
 @end menu
@@ -590,6 +591,33 @@ reordering of command line arguments by @code{getopt} and
 @c !!! GNU also has COREFILE, CORESERVER, EXECSERVERS
 @end table
 
+@node Auxiliary Vector
+@section Auxiliary Vector
+@cindex auxiliary vector
+
+When a program is executed, it receives information from the operating
+system about the environment in which it is operating.  The form of this
+information is a table of key-value pairs, where the keys are from the
+set of @samp{AT_} values in @file{elf.h}.  Some of the data is provided
+by the kernel for libc consumption, and may be obtained by ordinary
+interfaces, such as @code{sysconf}.  However, on a platform-by-platform
+basis there may be information that is not available any other way.
+
+@subsection Definition of @code{getauxval}
+@comment sys/auxv.h
+@deftypefun {unsigned long int} getauxval (unsigned long int @var{type})
+This function is used to inquire about the entries in the auxiliary
+vector.  The @var{type} argument should be one of the @samp{AT_} symbols
+defined in @file{elf.h}.  If a matching entry is found, the value is
+returned; if the entry is not found, zero is returned.
+@end deftypefun
+
+For some platforms, the key @code{AT_HWCAP} is the easiest way to inquire
+about any instruction set extensions available at runtime.  In this case,
+there will (of necessity) be a platform-specific set of @samp{HWCAP_}
+values masked together that describe the capabilities of the cpu on which
+the program is being executed.
+
 @node System Calls
 @section System Calls
 
diff --git a/misc/Makefile b/misc/Makefile
index f42347ab9d..d1c0a02e17 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -31,7 +31,7 @@ headers	:= sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
 	   regexp.h bits/select.h bits/mman.h sys/xattr.h \
 	   syslog.h sys/syslog.h \
 	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
-	   bits/select2.h
+	   bits/select2.h bits/hwcap.h sys/auxv.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev preadv preadv64 pwritev pwritev64 \
@@ -64,7 +64,7 @@ routines := brk sbrk sstk ioctl \
 	    getloadavg getclktck \
 	    fgetxattr flistxattr fremovexattr fsetxattr getxattr \
 	    listxattr lgetxattr llistxattr lremovexattr lsetxattr \
-	    removexattr setxattr
+	    removexattr setxattr getauxval
 
 generated := tst-error1.mtrace tst-error1-mem
 
diff --git a/misc/Versions b/misc/Versions
index 3a31c7fe62..7f525eaf5e 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -146,4 +146,7 @@ libc {
   GLIBC_2.14 {
     syncfs;
   }
+  GLIBC_2.16 {
+    __getauxval; getauxval;
+  }
 }
diff --git a/misc/getauxval.c b/misc/getauxval.c
new file mode 100644
index 0000000000..a3338eedd9
--- /dev/null
+++ b/misc/getauxval.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2012 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/>.  */
+
+#include <sys/auxv.h>
+#include <ldsodefs.h>
+
+
+unsigned long
+__getauxval (unsigned long type)
+{
+  ElfW(auxv_t) *p;
+
+  if (type == AT_HWCAP)
+    return GLRO(dl_hwcap);
+
+  for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
+    if (p->a_type == type)
+      return p->a_un.a_val;
+  return 0;
+}
+
+weak_alias (__getauxval, getauxval)
diff --git a/misc/sys/auxv.h b/misc/sys/auxv.h
new file mode 100644
index 0000000000..a70fb37f87
--- /dev/null
+++ b/misc/sys/auxv.h
@@ -0,0 +1,35 @@
+/* Access to the auxiliary vector.
+   Copyright (C) 2012 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 _SYS_AUXV_H
+#define _SYS_AUXV_H 1
+
+#include <elf.h>
+#include <bits/hwcap.h>
+
+__BEGIN_DECLS
+
+/* Return the value associated with an Elf*_auxv_t type from the auxv list
+   passed to the program on startup.  If __type was not present in the auxv
+   list, returns zero.  */
+extern unsigned long getauxval (unsigned long __type)
+  __THROW __attribute_const__;
+
+__END_DECLS
+
+#endif /* sys/auxv.h */
diff --git a/sysdeps/generic/bits/hwcap.h b/sysdeps/generic/bits/hwcap.h
new file mode 100644
index 0000000000..b27d2febb0
--- /dev/null
+++ b/sysdeps/generic/bits/hwcap.h
@@ -0,0 +1,23 @@
+/* Defines for bits in AT_HWCAP.
+   Copyright (C) 2012 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 _SYS_AUXV_H
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/* No bits defined for this architecture.  */
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index e071015cee..98cc123078 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -597,6 +597,9 @@ struct rtld_global_ro
   /* Mask for important hardware capabilities we honour. */
   EXTERN uint64_t _dl_hwcap_mask;
 
+  /* Pointer to the auxv list supplied to the program at startup.  */
+  EXTERN ElfW(auxv_t) *_dl_auxv;
+
   /* Get architecture specific definitions.  */
 #define PROCINFO_DECL
 #ifndef PROCINFO_CLASS
diff --git a/sysdeps/powerpc/bits/hwcap.h b/sysdeps/powerpc/bits/hwcap.h
new file mode 100644
index 0000000000..89e7d8b731
--- /dev/null
+++ b/sysdeps/powerpc/bits/hwcap.h
@@ -0,0 +1,53 @@
+/* Defines for bits in AT_HWCAP.
+   Copyright (C) 2012 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 _SYS_AUXV_H
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/*
+ * The following must match the kernels asm/cputable.h.
+ */
+#define PPC_FEATURE_32		    0x80000000 /* 32-bit mode. */
+#define PPC_FEATURE_64		    0x40000000 /* 64-bit mode. */
+#define PPC_FEATURE_601_INSTR	    0x20000000 /* 601 chip, Old POWER ISA.  */
+#define PPC_FEATURE_HAS_ALTIVEC	    0x10000000 /* SIMD/Vector Unit.  */
+#define PPC_FEATURE_HAS_FPU	    0x08000000 /* Floating Point Unit.  */
+#define PPC_FEATURE_HAS_MMU	    0x04000000 /* Memory Management Unit.  */
+#define PPC_FEATURE_HAS_4xxMAC	    0x02000000 /* 4xx Multiply Accumulator.  */
+#define PPC_FEATURE_UNIFIED_CACHE   0x01000000 /* Unified I/D cache.  */
+#define PPC_FEATURE_HAS_SPE	    0x00800000 /* Signal Processing ext.  */
+#define PPC_FEATURE_HAS_EFP_SINGLE  0x00400000 /* SPE Float.  */
+#define PPC_FEATURE_HAS_EFP_DOUBLE  0x00200000 /* SPE Double.  */
+#define PPC_FEATURE_NO_TB	    0x00100000 /* 601/403gx have no timebase */
+#define PPC_FEATURE_POWER4	    0x00080000 /* POWER4 ISA 2.00 */
+#define PPC_FEATURE_POWER5	    0x00040000 /* POWER5 ISA 2.02 */
+#define PPC_FEATURE_POWER5_PLUS	    0x00020000 /* POWER5+ ISA 2.03 */
+#define PPC_FEATURE_CELL_BE	    0x00010000 /* CELL Broadband Engine */
+#define PPC_FEATURE_BOOKE	    0x00008000
+#define PPC_FEATURE_SMT		    0x00004000 /* Simultaneous Multi-Threading */
+#define PPC_FEATURE_ICACHE_SNOOP    0x00002000
+#define PPC_FEATURE_ARCH_2_05	    0x00001000 /* ISA 2.05 */
+#define PPC_FEATURE_PA6T	    0x00000800 /* PA Semi 6T Core */
+#define PPC_FEATURE_HAS_DFP	    0x00000400 /* Decimal FP Unit */
+#define PPC_FEATURE_POWER6_EXT	    0x00000200 /* P6 + mffgpr/mftgpr */
+#define PPC_FEATURE_ARCH_2_06	    0x00000100 /* ISA 2.06 */
+#define PPC_FEATURE_HAS_VSX	    0x00000080 /* P7 Vector Extension.  */
+#define PPC_FEATURE_PSERIES_PERFMON_COMPAT  0x00000040
+#define PPC_FEATURE_TRUE_LE	    0x00000002
+#define PPC_FEATURE_PPC_LE	    0x00000001
diff --git a/sysdeps/powerpc/sysdep.h b/sysdeps/powerpc/sysdep.h
index 5cd8613d3e..7682ae9188 100644
--- a/sysdeps/powerpc/sysdep.h
+++ b/sysdeps/powerpc/sysdep.h
@@ -18,33 +18,10 @@
 /* 
  * Powerpc Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP). 
  * This entry is copied to _dl_hwcap or rtld_global._dl_hwcap during startup.
- * The following must match the kernels linux/asm/cputable.h.  
  */
-#define PPC_FEATURE_32			0x80000000 /* 32-bit mode. */
-#define PPC_FEATURE_64			0x40000000 /* 64-bit mode. */
-#define PPC_FEATURE_601_INSTR		0x20000000 /* 601 chip, Old POWER ISA.  */
-#define PPC_FEATURE_HAS_ALTIVEC		0x10000000 /* SIMD/Vector Unit.  */
-#define PPC_FEATURE_HAS_FPU		0x08000000 /* Floating Point Unit.  */
-#define PPC_FEATURE_HAS_MMU		0x04000000 /* Memory Management Unit.  */
-#define PPC_FEATURE_HAS_4xxMAC		0x02000000 /* 4xx Multiply Accumulator.  */
-#define PPC_FEATURE_UNIFIED_CACHE	0x01000000 /* Unified I/D cache.  */
-#define PPC_FEATURE_HAS_SPE		0x00800000 /* Signal Processing ext.  */
-#define PPC_FEATURE_HAS_EFP_SINGLE	0x00400000 /* SPE Float.  */
-#define PPC_FEATURE_HAS_EFP_DOUBLE	0x00200000 /* SPE Double.  */
-#define PPC_FEATURE_NO_TB		0x00100000 /* 601/403gx have no timebase */
-#define PPC_FEATURE_POWER4		0x00080000 /* POWER4 ISA 2.00 */
-#define PPC_FEATURE_POWER5		0x00040000 /* POWER5 ISA 2.02 */
-#define PPC_FEATURE_POWER5_PLUS		0x00020000 /* POWER5+ ISA 2.03 */
-#define PPC_FEATURE_CELL_BE		0x00010000 /* CELL Broadband Engine */
-#define PPC_FEATURE_BOOKE		0x00008000
-#define PPC_FEATURE_SMT			0x00004000 /* Simultaneous Multi-Threading */
-#define PPC_FEATURE_ICACHE_SNOOP	0x00002000
-#define PPC_FEATURE_ARCH_2_05		0x00001000 /* ISA 2.05 */
-#define PPC_FEATURE_PA6T		0x00000800 /* PA Semi 6T Core */
-#define PPC_FEATURE_HAS_DFP		0x00000400 /* Decimal FP Unit */
-#define PPC_FEATURE_POWER6_EXT		0x00000200 /* P6 + mffgpr/mftgpr */
-#define PPC_FEATURE_ARCH_2_06	        0x00000100 /* ISA 2.06 */
-#define PPC_FEATURE_HAS_VSX		0x00000080 /* P7 Vector Extension.  */
+#define _SYS_AUXV_H
+#include <bits/hwcap.h>
+
 #define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
 
 #ifdef __ASSEMBLER__
diff --git a/sysdeps/sparc/bits/hwcap.h b/sysdeps/sparc/bits/hwcap.h
new file mode 100644
index 0000000000..d922d7b0e8
--- /dev/null
+++ b/sysdeps/sparc/bits/hwcap.h
@@ -0,0 +1,47 @@
+/* Defines for bits in AT_HWCAP.
+   Copyright (C) 2011-2012 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 _SYS_AUXV_H
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+#define HWCAP_SPARC_FLUSH	0x00000001
+#define HWCAP_SPARC_STBAR	0x00000002
+#define HWCAP_SPARC_SWAP	0x00000004
+#define HWCAP_SPARC_MULDIV	0x00000008
+#define HWCAP_SPARC_V9		0x00000010
+#define HWCAP_SPARC_ULTRA3	0x00000020
+#define HWCAP_SPARC_BLKINIT	0x00000040
+#define HWCAP_SPARC_N2		0x00000080
+#define HWCAP_SPARC_MUL32	0x00000100
+#define HWCAP_SPARC_DIV32	0x00000200
+#define HWCAP_SPARC_FSMULD	0x00000400
+#define HWCAP_SPARC_V8PLUS	0x00000800
+#define HWCAP_SPARC_POPC	0x00001000
+#define HWCAP_SPARC_VIS		0x00002000
+#define HWCAP_SPARC_VIS2	0x00004000
+#define HWCAP_SPARC_ASI_BLK_INIT 0x00008000
+#define HWCAP_SPARC_FMAF	0x00010000
+#define HWCAP_SPARC_VIS3	0x00020000
+#define HWCAP_SPARC_HPC		0x00040000
+#define HWCAP_SPARC_RANDOM	0x00080000
+#define HWCAP_SPARC_TRANS	0x00100000
+#define HWCAP_SPARC_FJFMAU	0x00200000
+#define HWCAP_SPARC_IMA		0x00400000
+#define HWCAP_SPARC_ASI_CACHE_SPARING \
+				0x00800000
diff --git a/sysdeps/sparc/sysdep.h b/sysdeps/sparc/sysdep.h
index bcffec94f0..2d7b7f0213 100644
--- a/sysdeps/sparc/sysdep.h
+++ b/sysdeps/sparc/sysdep.h
@@ -15,33 +15,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Bits present in AT_HWCAP on SPARC.  */
-
-#define HWCAP_SPARC_FLUSH	0x00000001
-#define HWCAP_SPARC_STBAR	0x00000002
-#define HWCAP_SPARC_SWAP	0x00000004
-#define HWCAP_SPARC_MULDIV	0x00000008
-#define HWCAP_SPARC_V9		0x00000010
-#define HWCAP_SPARC_ULTRA3	0x00000020
-#define HWCAP_SPARC_BLKINIT	0x00000040
-#define HWCAP_SPARC_N2		0x00000080
-#define HWCAP_SPARC_MUL32	0x00000100
-#define HWCAP_SPARC_DIV32	0x00000200
-#define HWCAP_SPARC_FSMULD	0x00000400
-#define HWCAP_SPARC_V8PLUS	0x00000800
-#define HWCAP_SPARC_POPC	0x00001000
-#define HWCAP_SPARC_VIS		0x00002000
-#define HWCAP_SPARC_VIS2	0x00004000
-#define HWCAP_SPARC_ASI_BLK_INIT 0x00008000
-#define HWCAP_SPARC_FMAF	0x00010000
-#define HWCAP_SPARC_VIS3	0x00020000
-#define HWCAP_SPARC_HPC		0x00040000
-#define HWCAP_SPARC_RANDOM	0x00080000
-#define HWCAP_SPARC_TRANS	0x00100000
-#define HWCAP_SPARC_FJFMAU	0x00200000
-#define HWCAP_SPARC_IMA		0x00400000
-#define HWCAP_SPARC_ASI_CACHE_SPARING \
-				0x00800000
+#define _SYS_AUXV_H 1
+#include <bits/hwcap.h>
 
 #ifdef	__ASSEMBLER__
 
diff --git a/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist b/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
index ccb8f9f6e9..d6695ebb91 100644
--- a/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
@@ -1801,11 +1801,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
index 41d08819c9..bacdb6aab0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
@@ -1761,11 +1761,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
index c593952077..a0d362e111 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
@@ -68,11 +68,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F
diff --git a/sysdeps/unix/sysv/linux/s390/bits/hwcap.h b/sysdeps/unix/sysv/linux/s390/bits/hwcap.h
new file mode 100644
index 0000000000..7f03ffe461
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/bits/hwcap.h
@@ -0,0 +1,36 @@
+/* Defines for bits in AT_HWCAP.
+   Copyright (C) 2012 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 _SYS_AUXV_H
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+/*
+ * The following must match the kernels asm/elf.h.
+ * Note that these are *not* the same as the STORE FACILITY LIST bits.
+ */
+#define HWCAP_S390_ESAN3        1
+#define HWCAP_S390_ZARCH        2
+#define HWCAP_S390_STFLE        4
+#define HWCAP_S390_MSA          8
+#define HWCAP_S390_LDISP        16
+#define HWCAP_S390_EIMM         32
+#define HWCAP_S390_DFP          64
+#define HWCAP_S390_HPAGE        128
+#define HWCAP_S390_ETF3EH       256
+#define HWCAP_S390_HIGH_GPRS    512
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
index c015dafbf2..728550bdfc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
@@ -1758,11 +1758,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
index 8d57add926..1ca4811ea9 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
@@ -75,11 +75,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F
diff --git a/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
index ce6b549ac0..ae57b67f03 100644
--- a/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
@@ -75,11 +75,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
index 815e8af40c..1804348cfd 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
@@ -1753,6 +1753,7 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __getshmlba F
  __poll_chk F
  __ppoll_chk F
@@ -1761,6 +1762,7 @@ GLIBC_2.16
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  sys_errlist D 0x220
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
index 39c06427a4..2914d1c211 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
@@ -74,6 +74,7 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __getshmlba F
  __poll_chk F
  __ppoll_chk F
@@ -82,6 +83,7 @@ GLIBC_2.16
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  sys_errlist D 0x440
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
index 6f15f00e1f..2a1b8e9f93 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
@@ -70,11 +70,13 @@ GLIBC_2.15
  scandirat64 F
 GLIBC_2.16
  GLIBC_2.16 A
+ __getauxval F
  __poll_chk F
  __ppoll_chk F
  aligned_alloc F
  c16rtomb F
  c32rtomb F
+ getauxval F
  mbrtoc16 F
  mbrtoc32 F
  timespec_get F