aboutsummaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index f1b45de1e0..9529b9c14e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -264,6 +264,7 @@ dl_main (const ElfW(Phdr) *phdr,
size_t file_size;
char *file;
int has_interp = 0;
+ const char *library_path = NULL; /* Overwrites LD_LIBRARY_PATH if given. */
/* Test whether we want to see the content of the auxiliary array passed
up from the kernel. */
@@ -343,6 +344,15 @@ dl_main (const ElfW(Phdr) *phdr,
--_dl_argc;
++_dl_argv;
}
+ else if (! strcmp (_dl_argv[1], "--library-path")
+ && _dl_argc > 2)
+ {
+ library_path = _dl_argv[2];
+
+ _dl_skip_args += 2;
+ _dl_argc -= 2;
+ _dl_argv += 2;
+ }
else
break;
@@ -484,7 +494,7 @@ of this helper program; chances are you did not intend to run this program.\n",
/* Initialize the data structures for the search paths for shared
objects. */
- _dl_init_paths ();
+ _dl_init_paths (library_path);
preloadlist = getenv ("LD_PRELOAD");
if (preloadlist)