Skip to content

Latest commit

 

History

History
42 lines (38 loc) · 1.28 KB

glibc-2.25-elf-rtld.diff

File metadata and controls

42 lines (38 loc) · 1.28 KB
 
1
2
3
4
diff -ur glibc-2.14.1-orig/elf/rtld.c glibc-2.14.1/elf/rtld.c
--- glibc-2.14.1-orig/elf/rtld.c 2011-10-07 12:48:55.000000000 +0300
+++ glibc-2.14.1/elf/rtld.c 2011-11-16 17:00:19.000000000 +0200
@@ -930,6 +930,7 @@
Dec 4, 2018
Dec 4, 2018
5
6
7
if (*user_entry == (ElfW(Addr)) ENTRY_POINT)
{
Dec 4, 2018
Dec 4, 2018
8
+ char *forced_argv0 = NULL;
9
10
11
12
13
/* Ho ho. We are not the program interpreter! We are the program
itself! This means someone ran ld.so as a command. Well, that
might be convenient to do sometimes. We support it by
@@ -994,6 +995,14 @@
_dl_argc -= 2;
Dec 4, 2018
Dec 4, 2018
14
_dl_argv += 2;
Dec 4, 2018
Dec 4, 2018
16
+ else if (! strcmp (_dl_argv[1], "--argv0") && _dl_argc > 2)
Dec 4, 2018
Dec 4, 2018
18
+ forced_argv0 = _dl_argv[2];
19
20
21
+
+ _dl_skip_args += 2;
+ _dl_argc -= 2;
Dec 4, 2018
Dec 4, 2018
22
+ _dl_argv += 2;
23
24
25
+ }
else
break;
Dec 4, 2018
Dec 4, 2018
26
27
28
29
30
31
32
@@ -1021,6 +1030,7 @@
variable LD_LIBRARY_PATH\n\
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
in LIST\n\
+ --argv0 STRING use STRING as argv[0]\n\
--audit LIST use objects named in LIST as auditors\n");
Dec 4, 2018
Dec 4, 2018
33
34
35
36
37
++_dl_skip_args;
@@ -1073,6 +1083,8 @@
HP_TIMING_DIFF (load_time, start, stop);
}
Dec 4, 2018
Dec 4, 2018
38
39
40
41
42
+ if (forced_argv0 != NULL) _dl_argv[0] = forced_argv0;
+
/* Now the map for the main executable is available. */
main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;