about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-10-08 10:57:10 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-10-08 14:29:49 +0200
commit27316f4a23efdc90bdfe4569a6c4b7e27941606e (patch)
tree89958b354e27b96a2dda1315e347b3a548c2be9f /elf/rtld.c
parent9590a71adcf134c77f2d0f5711b0d6ab1b4193e6 (diff)
downloadglibc-27316f4a23efdc90bdfe4569a6c4b7e27941606e.tar.gz
glibc-27316f4a23efdc90bdfe4569a6c4b7e27941606e.tar.xz
glibc-27316f4a23efdc90bdfe4569a6c4b7e27941606e.zip
elf: Record whether paths come from LD_LIBRARY_PATH or --library-path
This allows more precise LD_DEBUG diagnostics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index ee5bf178af..c0609e4310 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -286,6 +286,7 @@ dl_main_state_init (struct dl_main_state *state)
 {
   audit_list_init (&state->audit_list);
   state->library_path = NULL;
+  state->library_path_source = NULL;
   state->preloadlist = NULL;
   state->preloadarg = NULL;
   state->mode = rtld_mode_normal;
@@ -1203,6 +1204,7 @@ dl_main (const ElfW(Phdr) *phdr,
 		 && _dl_argc > 2)
 	  {
 	    state.library_path = _dl_argv[2];
+	    state.library_path_source = "--library-path";
 
 	    _dl_skip_args += 2;
 	    _dl_argc -= 2;
@@ -2655,6 +2657,7 @@ process_envvars (struct dl_main_state *state)
 	      && memcmp (envline, "LIBRARY_PATH", 12) == 0)
 	    {
 	      state->library_path = &envline[13];
+	      state->library_path_source = "LD_LIBRARY_PATH";
 	      break;
 	    }