Compare commits

...
16 changed files with 123 additions and 13 deletions
+31
View File
@@ -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.
+10
View 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;
+13 -2
View 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;
}
+5 -1
View 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)
+1 -1
View 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) ""
+1 -1
View 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) ""
@@ -31,10 +31,14 @@
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)
+25
View File
@@ -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 */
+1 -1
View 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) ""
+9
View 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
+1 -1
View 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))
+5 -1
View 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)
+1 -1
View 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))
+5 -1
View File
@@ -27,10 +27,14 @@
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)
+5 -1
View File
@@ -24,12 +24,16 @@
#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)
+5 -1
View File
@@ -24,12 +24,16 @@
#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)