1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-10 05:03:06 +03:00

elf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps

In the current code, the function can easily obtain the information
on its own.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer
2020-10-09 10:13:14 +02:00
parent 647103ea3a
commit bb5fd5ce64
3 changed files with 12 additions and 14 deletions

View File

@@ -28,13 +28,12 @@
/* Return an array of useful/necessary hardware capability names. */ /* Return an array of useful/necessary hardware capability names. */
const struct r_strlenpair * const struct r_strlenpair *
_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, _dl_important_hwcaps (size_t *sz, size_t *max_capstrlen)
size_t *max_capstrlen)
{ {
uint64_t hwcap_mask = GET_HWCAP_MASK(); uint64_t hwcap_mask = GET_HWCAP_MASK();
/* Determine how many important bits are set. */ /* Determine how many important bits are set. */
uint64_t masked = GLRO(dl_hwcap) & hwcap_mask; uint64_t masked = GLRO(dl_hwcap) & hwcap_mask;
size_t cnt = platform != NULL; size_t cnt = GLRO (dl_platform) != NULL;
size_t n, m; size_t n, m;
size_t total; size_t total;
struct r_strlenpair *result; struct r_strlenpair *result;
@@ -60,10 +59,10 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
masked ^= 1ULL << n; masked ^= 1ULL << n;
++m; ++m;
} }
if (platform != NULL) if (GLRO (dl_platform) != NULL)
{ {
temp[m].str = platform; temp[m].str = GLRO (dl_platform);
temp[m].len = platform_len; temp[m].len = GLRO (dl_platformlen);
++m; ++m;
} }

View File

@@ -697,8 +697,7 @@ _dl_init_paths (const char *llp, const char *source)
#ifdef SHARED #ifdef SHARED
/* Get the capabilities. */ /* Get the capabilities. */
capstr = _dl_important_hwcaps (GLRO(dl_platform), GLRO(dl_platformlen), capstr = _dl_important_hwcaps (&ncapstr, &max_capstrlen);
&ncapstr, &max_capstrlen);
#endif #endif
/* First set up the rest of the default search directory entries. */ /* First set up the rest of the default search directory entries. */

View File

@@ -1071,10 +1071,10 @@ extern void _dl_show_auxv (void) attribute_hidden;
other. */ other. */
extern char *_dl_next_ld_env_entry (char ***position) attribute_hidden; extern char *_dl_next_ld_env_entry (char ***position) attribute_hidden;
/* Return an array with the names of the important hardware capabilities. */ /* Return an array with the names of the important hardware
extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform, capabilities. The length of the array is written to *SZ, and the
size_t paltform_len, maximum of all strings length is written to *MAX_CAPSTRLEN. */
size_t *sz, const struct r_strlenpair *_dl_important_hwcaps (size_t *sz,
size_t *max_capstrlen) size_t *max_capstrlen)
attribute_hidden; attribute_hidden;