Index: src/untrusted/nacl/nacl_irt_init.c |
diff --git a/src/untrusted/nacl/nacl_irt_init.c b/src/untrusted/nacl/nacl_irt_init.c |
index f0f02c52a77316349c03088641da80d696af7de0..8b7abe65ed0de45eb66ded5b6ab17e5f30e0889e 100644 |
--- a/src/untrusted/nacl/nacl_irt_init.c |
+++ b/src/untrusted/nacl/nacl_irt_init.c |
@@ -12,6 +12,67 @@ static int __libnacl_irt_mprotect(void *addr, size_t len, int prot) { |
return ENOSYS; |
} |
+#if 0 |
+void __libnacl_irt_init_module(void) { |
+ size_t count; |
+ size_t i; |
+ |
+ count = 0; |
+ while (NULL != nacl_irt_array[count].module_init) { |
+ ++count; |
+ } |
+ |
+ for (i = 0; i < count; ++i) { |
+ if (NULL != nacl_irt_array[i].module_init) { |
+ nacl_irt_array[i].module_init(); |
+ } |
+ } |
+} |
+ |
+void __libnacl_irt_fini_module(void) { |
+ size_t count; |
+ size_t i; |
+ |
+ count = 0; |
+ while (NULL != nacl_irt_array[count].module_init) { |
+ ++count; |
+ } |
+ |
+ for (i = 0; i < count; ++i) { |
+ if (NULL != nacl_irt_array[i].module_fini) { |
+ nacl_irt_array[i].module_fini(); |
+ } |
+ } |
+} |
+ |
+int nacl_irt_module_register(TYPE_nacl_irt_module_ctor ctor) { |
+ TYPE_nacl_irt_query irt_query = NULL; |
+ if ((irt_query = ctor(__nacl_irt_query)) != NULL) { |
+ __nacl_irt_query = irt_query; |
+ return 1; |
+ } |
+ return 0; |
+} |
+#endif |
+ |
+#if 0 |
+extern void (*__libnacl_irt_init_array_start []) (void) __attribute__((weak)); |
+extern void (*__libnacl_irt_init_array_end []) (void) __attribute__((weak)); |
+ |
+/* Iterate over all the init routines. */ |
+void __libnacl_irt_init_array(void) { |
+ size_t count; |
+ size_t i; |
+ |
+ _init(); |
+ |
+ count = __init_array_end - __init_array_start; |
+ for (i = 0; i < count; i++) { |
+ __init_array_start[i] (); |
+ } |
+} |
+#endif |
+ |
/* |
* Scan the auxv for AT_SYSINFO, which is the pointer to the IRT query function. |
* Stash that for later use. |
@@ -33,9 +94,22 @@ static void grok_auxv(const Elf32_auxv_t *auxv) { |
* Initialize all our IRT function tables using the query function. |
* The query function's address is passed via AT_SYSINFO in auxv. |
*/ |
-void __libnacl_irt_init(Elf32_auxv_t *auxv) { |
+void __libnacl_irt_init(int argc, char **argv, Elf32_auxv_t *auxv) { |
grok_auxv(auxv); |
+#if 0 |
+ { |
+ struct nacl_irt *irt = nacl_irt_new(NULL, __nacl_irt_query, NULL); |
+ if (irt != NULL) { |
+ nacl_irt_layer_init(irt->layer); |
+ } |
+ } |
+ DO_QUERY(NACL_IRT_INSTANCE_v0_1, instance); |
+ |
+ atexit(__libnacl_irt_instance.destroy); |
+ __libnacl_irt_instance.init(); |
+#endif |
+ |
/* |
* The "fdio" interface doesn't do anything useful in Chromium (with the |
* exception that write() sometimes produces useful debugging output for |