Skip to content

Commit

Permalink
Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan S. Arnold committed Jun 28, 2013
1 parent 8fbec01 commit 1ae8bfe
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 13 deletions.
25 changes: 25 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
2013-06-28 Ryan S. Arnold <rsa@linux.vnet.ibm.com>

* elf/dl-support.c (_dl_hwcap2): Add a new hwcap field for more
hardware capabilities in support of AT_HWCAP2.
(_dl_aux_init): Read AT_HWCAP2 into GLRO(dl_hwcap2).
* elf/dl-sysdep.c (_dl_sysdep_start): Read AT_HWCAP2 into
GLRO(dl_hwcap2).
(_dl_show_auxv): Add support for calling _dl_procinfo to display
AT_HWCAP2. If a platform doesn't chose to handle displaying AT_HWCAP2
explicitly the unknown a_type display mechanism is used.
* misc/getauxval.c (__getauxval): Return GLRO(dl_hwcap2) on AT_HWCAP2.
* sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_hwcap2 as a new
struct member.
* 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/powerpc/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 handler for TYPE == AT_HWCAP2 to
return -1 for unknown a_type display fallback.
* 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-28 Joseph Myers <joseph@codesourcery.com>

* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Shift by page_shift
Expand Down
4 changes: 4 additions & 0 deletions elf/dl-support.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ ElfW(auxv_t) *_dl_auxv;
const ElfW(Phdr) *_dl_phdr;
size_t _dl_phnum;
uint64_t _dl_hwcap __attribute__ ((nocommon));
uint64_t _dl_hwcap2 __attribute__ ((nocommon));

/* This is not initialized to HWCAP_IMPORTANT, matching the definition
of _dl_important_hwcaps, below, where no hwcap strings are ever
Expand Down Expand Up @@ -249,6 +250,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
case AT_HWCAP:
GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
break;
case AT_HWCAP2:
GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
break;
#ifdef NEED_DL_SYSINFO
case AT_SYSINFO:
GL(dl_sysinfo) = av->a_un.a_val;
Expand Down
10 changes: 7 additions & 3 deletions elf/dl-sysdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ _dl_sysdep_start (void **start_argptr,
case AT_HWCAP:
GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
break;
case AT_HWCAP2:
GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
break;
case AT_CLKTCK:
GLRO(dl_clktck) = av->a_un.a_val;
break;
Expand Down Expand Up @@ -303,6 +306,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);

Expand All @@ -314,10 +318,10 @@ _dl_show_auxv (void)
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)
/* These are handled in a special way per platform. */
if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0)
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions misc/getauxval.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ __getauxval (unsigned long int type)

if (type == AT_HWCAP)
return GLRO(dl_hwcap);
else if (type == AT_HWCAP2)
return GLRO(dl_hwcap2);

for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
if (p->a_type == type)
Expand Down
5 changes: 5 additions & 0 deletions ports/ChangeLog.alpha
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2013-06-28 Ryan S. Arnold <rsa@linux.vnet.ibm.com>

* sysdeps/alpha/dl-procinfo.h (_dl_procinfo): Add TYPE parameter
to macro prototype for AT_HWCAP2 support.

2013-06-24 Richard Henderson <rth@redhat.com>

[BZ #15666]
Expand Down
7 changes: 7 additions & 0 deletions ports/ChangeLog.arm
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2013-06-28 Ryan S. Arnold <rsa@linux.vnet.ibm.com>

* 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 handler for TYPE ==
AT_HWCAP2 to return -1 for unknown a_type display fallback.

2013-06-18 Roland McGrath <roland@hack.frob.com>

* sysdeps/arm/arm-mcount.S: Comment typo fix.
Expand Down
5 changes: 5 additions & 0 deletions ports/ChangeLog.mips
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2013-06-28 Ryan S. Arnold <rsa@linux.vnet.ibm.com>

* sysdeps/mips/dl-procinfo.h (_dl_procinfo): Add TYPE parameter
to macro prototype for AT_HWCAP2 support.

2013-06-27 Maciej W. Rozycki <macro@codesourcery.com>

* sysdeps/unix/sysv/linux/mips/dl-static.c: Do not include
Expand Down
2 changes: 1 addition & 1 deletion ports/sysdeps/alpha/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) ""
Expand Down
2 changes: 1 addition & 1 deletion ports/sysdeps/mips/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) ""
Expand Down
6 changes: 5 additions & 1 deletion ports/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@

static inline int
__attribute__ ((unused))
_dl_procinfo (int word)
_dl_procinfo (unsigned int type, unsigned long int word)
{
int i;

/* Fallback to unknown output mechanism. */
if (type == AT_HWCAP2)
return -1;

_dl_printf ("AT_HWCAP: ");

for (i = 0; i < _DL_HWCAP_COUNT; ++i)
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/generic/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) ""
Expand Down
4 changes: 4 additions & 0 deletions sysdeps/generic/ldsodefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ struct rtld_global_ro
EXTERN struct link_map *_dl_sysinfo_map;
#endif

/* Mask for more hardware capabilities that are available on some
platforms. */
EXTERN uint64_t _dl_hwcap2;

#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
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/i386/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 5 additions & 1 deletion sysdeps/powerpc/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/* Fallback to unknown output mechanism. */
if (type == AT_HWCAP2)
return -1;

_dl_printf ("AT_HWCAP: ");

for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/s390/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 5 additions & 1 deletion sysdeps/sparc/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@

static inline int
__attribute__ ((unused))
_dl_procinfo (int word)
_dl_procinfo (unsigned int type, unsigned long int word)
{
int i;

/* Fallback to unknown output mechanism. */
if (type == AT_HWCAP2)
return -1;

_dl_printf ("AT_HWCAP: ");

for (i = 0; i < _DL_HWCAP_COUNT; ++i)
Expand Down
6 changes: 5 additions & 1 deletion sysdeps/unix/sysv/linux/i386/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/* Fallback to unknown output mechanism. */
if (type == AT_HWCAP2)
return -1;

_dl_printf ("AT_HWCAP: ");

for (i = 0; i < _DL_HWCAP_COUNT; ++i)
Expand Down
6 changes: 5 additions & 1 deletion sysdeps/unix/sysv/linux/s390/dl-procinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/* Fallback to unknown output mechanism. */
if (type == AT_HWCAP2)
return -1;

_dl_printf ("AT_HWCAP: ");

for (i = 0; i < _DL_HWCAP_COUNT; ++i)
Expand Down

0 comments on commit 1ae8bfe

Please sign in to comment.