e354a5
commit bb5fd5ce64b598085bdb8a05cb53777480fe093c
e354a5
Author: Florian Weimer <fweimer@redhat.com>
e354a5
Date:   Fri Oct 9 10:13:14 2020 +0200
e354a5
e354a5
    elf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps
e354a5
    
e354a5
    In the current code, the function can easily obtain the information
e354a5
    on its own.
e354a5
    
e354a5
    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
e354a5
e354a5
diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
e354a5
index ae2e4ca7fe91d407..82ee89c36a1eb4ab 100644
e354a5
--- a/elf/dl-hwcaps.c
e354a5
+++ b/elf/dl-hwcaps.c
e354a5
@@ -28,13 +28,12 @@
e354a5
 
e354a5
 /* Return an array of useful/necessary hardware capability names.  */
e354a5
 const struct r_strlenpair *
e354a5
-_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
e354a5
-		      size_t *max_capstrlen)
e354a5
+_dl_important_hwcaps (size_t *sz, size_t *max_capstrlen)
e354a5
 {
e354a5
   uint64_t hwcap_mask = GET_HWCAP_MASK();
e354a5
   /* Determine how many important bits are set.  */
e354a5
   uint64_t masked = GLRO(dl_hwcap) & hwcap_mask;
e354a5
-  size_t cnt = platform != NULL;
e354a5
+  size_t cnt = GLRO (dl_platform) != NULL;
e354a5
   size_t n, m;
e354a5
   size_t total;
e354a5
   struct r_strlenpair *result;
e354a5
@@ -60,10 +59,10 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
e354a5
 	masked ^= 1ULL << n;
e354a5
 	++m;
e354a5
       }
e354a5
-  if (platform != NULL)
e354a5
+  if (GLRO (dl_platform) != NULL)
e354a5
     {
e354a5
-      temp[m].str = platform;
e354a5
-      temp[m].len = platform_len;
e354a5
+      temp[m].str = GLRO (dl_platform);
e354a5
+      temp[m].len = GLRO (dl_platformlen);
e354a5
       ++m;
e354a5
     }
e354a5
 
e354a5
diff --git a/elf/dl-load.c b/elf/dl-load.c
e354a5
index 2eb4f35b2467f7d8..d2be21ea7d1545fe 100644
e354a5
--- a/elf/dl-load.c
e354a5
+++ b/elf/dl-load.c
e354a5
@@ -697,8 +697,7 @@ _dl_init_paths (const char *llp, const char *source)
e354a5
 
e354a5
 #ifdef SHARED
e354a5
   /* Get the capabilities.  */
e354a5
-  capstr = _dl_important_hwcaps (GLRO(dl_platform), GLRO(dl_platformlen),
e354a5
-				 &ncapstr, &max_capstrlen);
e354a5
+  capstr = _dl_important_hwcaps (&ncapstr, &max_capstrlen);
e354a5
 #endif
e354a5
 
e354a5
   /* First set up the rest of the default search directory entries.  */
e354a5
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
e354a5
index aa006afafaf46dee..2c9fdeb286bdaadf 100644
e354a5
--- a/sysdeps/generic/ldsodefs.h
e354a5
+++ b/sysdeps/generic/ldsodefs.h
e354a5
@@ -1069,12 +1069,12 @@ extern void _dl_show_auxv (void) attribute_hidden;
e354a5
    other.  */
e354a5
 extern char *_dl_next_ld_env_entry (char ***position) attribute_hidden;
e354a5
 
e354a5
-/* Return an array with the names of the important hardware capabilities.  */
e354a5
-extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform,
e354a5
-							size_t paltform_len,
e354a5
-							size_t *sz,
e354a5
-							size_t *max_capstrlen)
e354a5
-     attribute_hidden;
e354a5
+/* Return an array with the names of the important hardware
e354a5
+   capabilities.  The length of the array is written to *SZ, and the
e354a5
+   maximum of all strings length is written to *MAX_CAPSTRLEN.  */
e354a5
+const struct r_strlenpair *_dl_important_hwcaps (size_t *sz,
e354a5
+						 size_t *max_capstrlen)
e354a5
+  attribute_hidden;
e354a5
 
e354a5
 /* Look up NAME in ld.so.cache and return the file name stored there,
e354a5
    or null if none is found.  Caller must free returned string.  */