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