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