Use shared globals to init __progname + environ
Initialize the __progname and environ global variables using
libc_shared_globals rather than KernelArgumentBlock.
Also: suppose the linker is invoked on an executable:
linker prog [args...]
The first argument passed to main() and constructor functions is "prog"
rather than "linker". For consistency, this CL changes the BSD
__progname global from "linker" to "prog".
Bug: none
Test: bionic unit tests
Change-Id: I376d76953c9436706dbc53911ef6585c1acc1c31
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index e9eaee0..906d569 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -58,6 +58,10 @@
pthread_mutex_t abort_msg_lock;
abort_msg_t* abort_msg;
+
+ // Values passed from the linker to libc.so.
+ const char* init_progname;
+ char** init_environ;
};
__LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();