@@ -25,6 +25,7 @@
#include <dl-procinfo.h>
#include <dl-tunables.h>
+#include <dl-hwcaps.h>
#ifdef _DL_FIRST_PLATFORM
# define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT)
@@ -38,11 +39,7 @@ internal_function
_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
size_t *max_capstrlen)
{
-#if HAVE_TUNABLES
- uint64_t hwcap_mask = TUNABLE_GET (glibc, tune, hwcap_mask, uint64_t);
-#else
- uint64_t hwcap_mask = GLRO(dl_hwcap_mask);
-#endif
+ uint64_t hwcap_mask = GET_HWCAP_MASK();
/* Determine how many important bits are set. */
uint64_t masked = GLRO(dl_hwcap) & hwcap_mask;
size_t cnt = platform != NULL;
new file mode 100644
@@ -0,0 +1,25 @@
+/* Hardware capability support for run-time dynamic loader.
+ Copyright (C) 2017 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 <elf/dl-tunables.h>
+
+#if HAVE_TUNABLES
+# define GET_HWCAP_MASK() TUNABLE_GET (glibc, tune, hwcap_mask, uint64_t)
+#else
+# define GET_HWCAP_MASK() GLRO(dl_hwcap_mask)
+#endif
@@ -27,7 +27,7 @@
#include <sysdep.h>
#include <tls.h>
#include <dl-plt.h>
-#include <elf/dl-tunables.h>
+#include <elf/dl-hwcaps.h>
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int
@@ -39,12 +39,7 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
{
/* XXX The following is wrong! Dave Miller rejected to implement it
correctly. If this causes problems shoot *him*! */
-#ifdef SHARED
-# if HAVE_TUNABLES
- uint64_t hwcap_mask = TUNABLE_GET (glibc, tune, hwcap_mask, uint64_t);
-# else
- uint64_t hwcap_mask = GLRO(dl_hwcap_mask);
-# endif
+ uint64_t hwcap_mask = GET_HWCAP_MASK();
return GLRO(dl_hwcap) & hwcap_mask & HWCAP_SPARC_V9;
#else
return GLRO(dl_hwcap) & HWCAP_SPARC_V9;
@@ -18,17 +18,12 @@
#include <cpu-features.h>
#include <sys/auxv.h>
-#include <elf/dl-tunables.h>
+#include <elf/dl-hwcaps.h>
static inline void
init_cpu_features (struct cpu_features *cpu_features)
{
-#if HAVE_TUNABLES
- uint64_t hwcap_mask = TUNABLE_GET (glibc, tune, hwcap_mask, uint64_t);
-#else
- uint64_t hwcap_mask = GLRO (dl_hwcap_mask);
-#endif
-
+ uint64_t hwcap_mask = GET_HWCAP_MASK();
uint64_t hwcap = GLRO (dl_hwcap) & hwcap_mask;
if (hwcap & HWCAP_CPUID)