+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.
#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>
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
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;
#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;
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;
[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);
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;
}
#include <sys/auxv.h>
#include <ldsodefs.h>
-
+#include <dl-hwcap2.h>
unsigned long int
__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)
};
/* 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 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)
--- /dev/null
+/* 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 */
#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) ""
size_t count;
void *list[50];
} *_dl_scope_free_list;
+
#ifdef SHARED
};
# define __rtld_global_attribute__
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
};
/* We cannot provide a general printing function. */
-#define _dl_procinfo(word) -1
+#define _dl_procinfo(type, word) -1
static inline const char *
__attribute__ ((unused))
#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)
| 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 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)
#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)
#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)