+2013-06-13 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
+
+ * elf/dl-support.c (_dl_aux_init): Add support for AT_HWCAP2.
+ * elf/dl-sysdep.c (_dl_sysdep_start, _dl_show_auxv): Likewise.
+ * misc/getauxval.c (__getauxval): Likewise.
+ * elf/elf.h (AT_HWCAP2): Add a new a_type entry.
+ * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Extend for
+ for an additional 32 AT_HWCAP2 flags.
+ * sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Add support for
+ displaying AT_HWCAP2 strings. Add TYPE parameter. Make WORD unsigned
+ rather than signed.
+ * sysdeps/generic/dl-procinfo.h (_dl_procinfo): Add TYPE parameter to
+ macro prototype for AT_HWCAP2 support.
+ * sysdeps/i386/dl-procinfo.h: Likewise.
+ * sysdeps/s390/dl-procinfo.h: Likewise.
+ * sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Add TYPE parameter for
+ future AT_HWCAP2 support. Make WORD unsigned rather than signed.
+ * sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/dl-procinfo.h: Likewise.
+
2013-06-13 Siddhesh Poyarekar <siddhesh@redhat.com>
* NEWS: Fix note on clock function precision. Text by Roland
uid_t uid = 0;
gid_t gid = 0;
+ /* Don't rely on a specific order of AT_HWCAP and AT_HWCAP2. Collate into a
+ zeroed temp and assign to _dl_hwcap after the auxv has been parsed. */
+ uint64_t hwcap = 0;
+
_dl_auxv = av;
for (; av->a_type != AT_NULL; ++av)
switch (av->a_type)
GL(dl_phnum) = av->a_un.a_val;
break;
case AT_HWCAP:
- GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
+ hwcap |= (unsigned long int) av->a_un.a_val;
+ break;
+ case AT_HWCAP2:
+ hwcap |= (uint64_t) av->a_un.a_val << 32;
break;
+
#ifdef NEED_DL_SYSINFO
case AT_SYSINFO:
GL(dl_sysinfo) = av->a_un.a_val;
DL_PLATFORM_AUXV
# endif
}
+
+ GLRO(dl_hwcap) = hwcap;
+
if (seen == 0xf)
{
__libc_enable_secure = uid != 0 || gid != 0;
uintptr_t new_sysinfo = 0;
#endif
+ /* Don't rely on a specific order of AT_HWCAP and AT_HWCAP2. Collate into a
+ zeroed temp and assign to _dl_hwcap after the auxv has been parsed. */
+ uint64_t hwcap = 0;
+
__libc_stack_end = DL_STACK_END (start_argptr);
DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ,
GLRO(dl_auxv));
GLRO(dl_platform) = (void *) av->a_un.a_val;
break;
case AT_HWCAP:
- GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
+ hwcap |= (unsigned long int) av->a_un.a_val;
+ break;
+ case AT_HWCAP2:
+ hwcap |= (uint64_t) av->a_un.a_val << 32;
break;
case AT_CLKTCK:
GLRO(dl_clktck) = av->a_un.a_val;
#endif
}
+ GLRO(dl_hwcap) = hwcap;
+
#ifndef HAVE_AUX_SECURE
if (seen != -1)
{
[AT_SYSINFO - 2] = { "SYSINFO: 0x", hex },
[AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex },
[AT_RANDOM - 2] = { "RANDOM: 0x", hex },
+ [AT_HWCAP2 - 2] = { "HWCAP2: ", hex },
};
unsigned int idx = (unsigned int) (av->a_type - 2);
assert (AT_NULL == 0);
assert (AT_IGNORE == 1);
- if (av->a_type == AT_HWCAP)
+ if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2)
{
- /* This is handled special. */
- if (_dl_procinfo (av->a_un.a_val) == 0)
+ /* HWCAP bits are translated into representative strings, per
+ platform. */
+ if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0)
continue;
}
/* Some more special a_type values describing the hardware. */
#define AT_PLATFORM 15 /* String identifying platform. */
-#define AT_HWCAP 16 /* Machine dependent hints about
+#define AT_HWCAP 16 /* Machine-dependent hints about
processor capabilities. */
/* This entry gives some information about the FPU initialization
#define AT_RANDOM 25 /* Address of 16 random bytes. */
+#define AT_HWCAP2 26 /* More machine-dependent hints
+ about processor capabilities. */
+
#define AT_EXECFN 31 /* Filename of executable. */
/* Pointer to the global system page used for system calls and other
if (type == AT_HWCAP)
return GLRO(dl_hwcap);
+ else if (type == AT_HWCAP2)
+ return GLRO(dl_hwcap) >> 32;
for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
if (p->a_type == type)
+2013-06-13 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
+
+ * sysdeps/alpha/dl-procinfo.h (_dl_procinfo): Add TYPE parameter for
+ AT_HWCAP2 support.
+
2013-06-05 Joseph Myers <joseph@codesourcery.com>
* sysdeps/alpha/bits/atomic.h: Remove trailing whitespace.
+2013-06-13 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
+
+ * sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo): Add
+ TYPE parameter for AT_HWCAP2 support. Make WORD unsigned.
+
2013-06-11 Joseph Myers <joseph@codesourcery.com>
* sysdeps/arm/math-tests.h [__SOFTFP__] (EXCEPTION_TESTS_float):
+2013-06-13 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
+
+ * sysdeps/mips/dl-procinfo.h (_dl_procinfo): Add TYPE parameter for
+ AT_HWCAP2 support.
+
2013-06-05 Joseph Myers <joseph@codesourcery.com>
* sysdeps/mips/fpu/fgetexcptflg.c: Remove trailing whitespace.
};
/* 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) ""
};
/* 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) ""
static inline int
__attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned int word)
{
int i;
+ /* Unused for now. */
+ if (type == AT_HWCAP2)
+ return 0;
+
_dl_printf ("AT_HWCAP: ");
for (i = 0; i < _DL_HWCAP_COUNT; ++i)
#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) ""
};
/* We cannot provide a general printing function. */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
static inline const char *
__attribute__ ((unused))
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_cap_flags
#else
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[25][10]
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[57][10]
#endif
#ifndef PROCINFO_DECL
= {
"notb", "efpdouble", "efpsingle", "spe",
"ucache", "4xxmac", "mmu", "fpu",
"altivec", "ppc601", "ppc64", "ppc32",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", "",
}
#endif
#if !defined SHARED || defined PROCINFO_DECL
#define _DL_PROCINFO_H 1
#include <ldsodefs.h>
-#include <sysdep.h> /* This defines the PPC_FEATURE_* macros. */
+#include <sysdep.h> /* This defines the PPC_FEATURE[2]_* macros. */
-/* There are 25 bits used, but they are bits 7..31. */
+/* There are 25 bits used in AT_HWCAP, but they are bits 7..31. The feature
+ * definitions started at bit 31 and decremented as new features were added.
+ */
+#define _DL_HWCAP_LAST 31
#define _DL_HWCAP_FIRST 7
-#define _DL_HWCAP_COUNT 32
+
+/* AT_HWCAP2 feature bits similarily started at bit 31 and decremented as new
+ features were added. HWCAP2 feature bits start at bit 0. */
+#define _DL_HWCAP2_LAST 31
+
+/* The total number of available bits (including those prior to
+ _DL_HWCAP_FIRST). Some of these bits might not be used. */
+#define _DL_HWCAP_COUNT 64
/* These bits influence library search. */
#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
}
#ifdef IS_IN_rtld
+
static inline int
__attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned int word)
{
- _dl_printf ("AT_HWCAP: ");
-
- for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
- if (word & (1 << i))
- _dl_printf (" %s", _dl_hwcap_string (i));
+ switch(type)
+ {
+ case AT_HWCAP:
+ _dl_printf ("AT_HWCAP: ");
+
+ for (int i = _DL_HWCAP_FIRST; i <= _DL_HWCAP_LAST; ++i)
+ if (word & (1 << i))
+ _dl_printf (" %s", _dl_hwcap_string (i));
+ break;
+ case AT_HWCAP2:
+ {
+ unsigned int offset = _DL_HWCAP_LAST + 1;
+
+ _dl_printf ("AT_HWCAP2: ");
+
+ /* We have to go through them all because the kernel added the
+ AT_HWCAP2 features starting with the high bits. */
+ for (int i = 0; i <= _DL_HWCAP2_LAST; ++i)
+ if (word & (1 << i))
+ _dl_printf (" %s", _dl_hwcap_string (offset + i));
+ break;
+ }
+ default:
+ /* This should not happen. */
+ return -1;
+ }
_dl_printf ("\n");
| 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))
static inline int
__attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned int word)
{
int i;
+ /* Unused for now. */
+ if (type == AT_HWCAP2)
+ return 0;
+
_dl_printf ("AT_HWCAP: ");
for (i = 0; i < _DL_HWCAP_COUNT; ++i)
#undef _dl_procinfo
static inline int
__attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned int word)
{
/* This table should match the information from arch/i386/kernel/setup.c
in the kernel sources. */
int i;
+ /* Unused for now. */
+ if (type == AT_HWCAP2)
+ return 0;
+
_dl_printf ("AT_HWCAP: ");
for (i = 0; i < _DL_HWCAP_COUNT; ++i)
#undef _dl_procinfo
static inline int
__attribute__ ((unused))
-_dl_procinfo (int word)
+_dl_procinfo (unsigned int type, unsigned int word)
{
/* This table should match the information from arch/s390/kernel/setup.c
in the kernel sources. */
int i;
+ /* Unused for now. */
+ if (type == AT_HWCAP2)
+ return 0;
+
_dl_printf ("AT_HWCAP: ");
for (i = 0; i < _DL_HWCAP_COUNT; ++i)