aboutsummaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-03-02 14:38:42 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-03-02 14:39:24 +0100
commit851f32cf7bf7067f73b991610778915edd57d7b4 (patch)
tree872288e8f663ef64124423379cce7889ed077ae0 /elf/rtld.c
parent40d055a2ddc86b76d4887e548ed20e40761102b1 (diff)
downloadglibc-851f32cf7bf7067f73b991610778915edd57d7b4.zip
glibc-851f32cf7bf7067f73b991610778915edd57d7b4.tar.gz
glibc-851f32cf7bf7067f73b991610778915edd57d7b4.tar.bz2
ld.so: Implement the --list-diagnostics option
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 596b6ac..94a00e2 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -141,6 +141,7 @@ static void dl_main_state_init (struct dl_main_state *state);
/* Process all environments variables the dynamic linker must recognize.
Since all of them start with `LD_' we are a bit smarter while finding
all the entries. */
+extern char **_environ attribute_hidden;
static void process_envvars (struct dl_main_state *state);
#ifdef DL_ARGV_NOT_RELRO
@@ -1287,6 +1288,14 @@ dl_main (const ElfW(Phdr) *phdr,
++_dl_argv;
}
#endif
+ else if (! strcmp (_dl_argv[1], "--list-diagnostics"))
+ {
+ state.mode = rtld_mode_list_diagnostics;
+
+ ++_dl_skip_args;
+ --_dl_argc;
+ ++_dl_argv;
+ }
else if (strcmp (_dl_argv[1], "--help") == 0)
{
state.mode = rtld_mode_help;
@@ -1315,6 +1324,9 @@ dl_main (const ElfW(Phdr) *phdr,
}
#endif
+ if (state.mode == rtld_mode_list_diagnostics)
+ _dl_print_diagnostics (_environ);
+
/* If we have no further argument the program was called incorrectly.
Grant the user some education. */
if (_dl_argc < 2)
@@ -2649,12 +2661,6 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n");
}
}
-/* Process all environments variables the dynamic linker must recognize.
- Since all of them start with `LD_' we are a bit smarter while finding
- all the entries. */
-extern char **_environ attribute_hidden;
-
-
static void
process_envvars (struct dl_main_state *state)
{