Clean up the argc/argv/envp/auxv handling.
There's now only one place where we deal with this stuff, it only needs to
be parsed once by the dynamic linker (rather than by each recipient), and it's
now easier for us to get hold of auxv data early on.
Change-Id: I6314224257c736547aac2e2a650e66f2ea53bef5
diff --git a/libc/arch-arm/bionic/crtbegin.c b/libc/arch-arm/bionic/crtbegin.c
index 0e2d31e..cc58797 100644
--- a/libc/arch-arm/bionic/crtbegin.c
+++ b/libc/arch-arm/bionic/crtbegin.c
@@ -26,21 +26,8 @@
* SUCH DAMAGE.
*/
-typedef struct
-{
- void (**preinit_array)(void);
- void (**init_array)(void);
- void (**fini_array)(void);
-} structors_array_t;
-
-extern int main(int argc, char **argv, char **env);
-
-extern void __libc_init(
- unsigned int *elfdata,
- void (*onexit)(void),
- int (*slingshot)(int, char**, char**),
- structors_array_t const * const structors
-);
+#include "../../bionic/libc_init_common.h"
+#include <stddef.h>
__attribute__ ((section (".preinit_array")))
void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
@@ -51,17 +38,14 @@
__attribute__ ((section (".fini_array")))
void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
-__attribute__((visibility("hidden")))
-void _start() {
+__LIBC_HIDDEN__ void _start() {
structors_array_t array;
- void *elfdata;
-
array.preinit_array = &__PREINIT_ARRAY__;
- array.init_array = &__INIT_ARRAY__;
- array.fini_array = &__FINI_ARRAY__;
+ array.init_array = &__INIT_ARRAY__;
+ array.fini_array = &__FINI_ARRAY__;
- elfdata = __builtin_frame_address(0) + sizeof(void *);
- __libc_init(elfdata, (void *) 0, &main, &array);
+ void* raw_args = __builtin_frame_address(0) + sizeof(void*);
+ __libc_init(raw_args, NULL, &main, &array);
}
#include "__dso_handle.h"