|
|
e354a5 |
commit 647103ea3a2aae2e6791b3bebe9e33eedc168102
|
|
|
e354a5 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
e354a5 |
Date: Fri Oct 9 10:13:14 2020 +0200
|
|
|
e354a5 |
|
|
|
e354a5 |
elf: Enhance ld.so --help to print HWCAP subdirectories
|
|
|
e354a5 |
|
|
|
e354a5 |
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
e354a5 |
|
|
|
e354a5 |
diff --git a/elf/dl-usage.c b/elf/dl-usage.c
|
|
|
e354a5 |
index 8d39bc9d5442bc59..c07f43835bd771cf 100644
|
|
|
e354a5 |
--- a/elf/dl-usage.c
|
|
|
e354a5 |
+++ b/elf/dl-usage.c
|
|
|
e354a5 |
@@ -22,6 +22,8 @@
|
|
|
e354a5 |
#include <unistd.h>
|
|
|
e354a5 |
#include "version.h"
|
|
|
e354a5 |
|
|
|
e354a5 |
+#include <dl-hwcaps.h>
|
|
|
e354a5 |
+
|
|
|
e354a5 |
void
|
|
|
e354a5 |
_dl_usage (const char *argv0, const char *wrong_option)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
@@ -101,6 +103,65 @@ print_search_path_for_help (struct dl_main_state *state)
|
|
|
e354a5 |
print_search_path_for_help_1 (__rtld_search_dirs.dirs);
|
|
|
e354a5 |
}
|
|
|
e354a5 |
|
|
|
e354a5 |
+/* Helper function for printing flags associated with a HWCAP name. */
|
|
|
e354a5 |
+static void
|
|
|
e354a5 |
+print_hwcap_1 (bool *first, bool active, const char *label)
|
|
|
e354a5 |
+{
|
|
|
e354a5 |
+ if (active)
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ if (*first)
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ _dl_printf (" (");
|
|
|
e354a5 |
+ *first = false;
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
+ else
|
|
|
e354a5 |
+ _dl_printf (", ");
|
|
|
e354a5 |
+ _dl_printf ("%s", label);
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
+}
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+/* Called after a series of print_hwcap_1 calls to emit the line
|
|
|
e354a5 |
+ terminator. */
|
|
|
e354a5 |
+static void
|
|
|
e354a5 |
+print_hwcap_1_finish (bool *first)
|
|
|
e354a5 |
+{
|
|
|
e354a5 |
+ if (*first)
|
|
|
e354a5 |
+ _dl_printf ("\n");
|
|
|
e354a5 |
+ else
|
|
|
e354a5 |
+ _dl_printf (")\n");
|
|
|
e354a5 |
+}
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+/* Write a list of hwcap subdirectories to standard output. See
|
|
|
e354a5 |
+ _dl_important_hwcaps in dl-hwcaps.c. */
|
|
|
e354a5 |
+static void
|
|
|
e354a5 |
+print_legacy_hwcap_directories (void)
|
|
|
e354a5 |
+{
|
|
|
e354a5 |
+ _dl_printf ("\n\
|
|
|
e354a5 |
+Legacy HWCAP subdirectories under library search path directories:\n");
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+ const char *platform = GLRO (dl_platform);
|
|
|
e354a5 |
+ if (platform != NULL)
|
|
|
e354a5 |
+ _dl_printf (" %s (AT_PLATFORM; supported, searched)\n", platform);
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+ _dl_printf (" tls (supported, searched)\n");
|
|
|
e354a5 |
+
|
|
|
e354a5 |
+ uint64_t hwcap_mask = GET_HWCAP_MASK();
|
|
|
e354a5 |
+ uint64_t searched = GLRO (dl_hwcap) & hwcap_mask;
|
|
|
e354a5 |
+ for (int n = 63; n >= 0; --n)
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ uint64_t bit = 1ULL << n;
|
|
|
e354a5 |
+ if (HWCAP_IMPORTANT & bit)
|
|
|
e354a5 |
+ {
|
|
|
e354a5 |
+ _dl_printf (" %s", _dl_hwcap_string (n));
|
|
|
e354a5 |
+ bool first = true;
|
|
|
e354a5 |
+ print_hwcap_1 (&first, GLRO (dl_hwcap) & bit, "supported");
|
|
|
e354a5 |
+ print_hwcap_1 (&first, !(hwcap_mask & bit), "masked");
|
|
|
e354a5 |
+ print_hwcap_1 (&first, searched & bit, "searched");
|
|
|
e354a5 |
+ print_hwcap_1_finish (&first);
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
+ }
|
|
|
e354a5 |
+}
|
|
|
e354a5 |
+
|
|
|
e354a5 |
void
|
|
|
e354a5 |
_dl_help (const char *argv0, struct dl_main_state *state)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
@@ -136,5 +197,6 @@ This program interpreter self-identifies as: " RTLD "\n\
|
|
|
e354a5 |
",
|
|
|
e354a5 |
argv0);
|
|
|
e354a5 |
print_search_path_for_help (state);
|
|
|
e354a5 |
+ print_legacy_hwcap_directories ();
|
|
|
e354a5 |
_exit (EXIT_SUCCESS);
|
|
|
e354a5 |
}
|