| Index: src/untrusted/irt/irt_entry.c
|
| diff --git a/src/untrusted/irt/irt_entry.c b/src/untrusted/irt/irt_entry.c
|
| index 89f51f62377551280c778096a071cba461fc4150..686d40bfbc0a5dcf7580e2e3c106d7e381445d5d 100644
|
| --- a/src/untrusted/irt/irt_entry.c
|
| +++ b/src/untrusted/irt/irt_entry.c
|
| @@ -9,6 +9,8 @@
|
|
|
| #include "native_client/src/include/elf32.h"
|
| #include "native_client/src/include/elf_auxv.h"
|
| +#include "native_client/src/shared/platform/nacl_log.h"
|
| +#include "native_client/src/shared/srpc/nacl_srpc.h"
|
| #include "native_client/src/untrusted/irt/irt_interfaces.h"
|
| #include "native_client/src/untrusted/nacl/nacl_irt.h"
|
| #include "native_client/src/untrusted/nacl/nacl_startup.h"
|
| @@ -17,6 +19,25 @@
|
| void __libc_init_array(void);
|
|
|
| /*
|
| + * This is declared as weak because plugin_main_nacl.cc on the
|
| + * Chromium side has a copy of IrtInit().
|
| + * TODO(mseaborn): Remove IrtInit() from there and use this copy.
|
| + */
|
| +__attribute__((weak))
|
| +int IrtInit(void) {
|
| + static int initialized = 0;
|
| + if (initialized) {
|
| + return 0;
|
| + }
|
| + if (!NaClSrpcModuleInit()) {
|
| + return 1;
|
| + }
|
| + NaClLogModuleInit(); /* Enable NaClLog'ing used by CHECK(). */
|
| + initialized = 1;
|
| + return 0;
|
| +}
|
| +
|
| +/*
|
| * This is the true entry point for untrusted code.
|
| * See nacl_startup.h for the layout at the argument pointer.
|
| */
|
| @@ -40,6 +61,12 @@ void _start(uint32_t *info) {
|
|
|
| __libc_init_array();
|
|
|
| + if (IrtInit()) {
|
| + static const char fatal_msg[] = "IrtInit() failed\n";
|
| + write(2, fatal_msg, sizeof(fatal_msg) - 1);
|
| + _exit(-1);
|
| + }
|
| +
|
| Elf32_auxv_t *entry = NULL;
|
| for (Elf32_auxv_t *av = auxv; av->a_type != AT_NULL; ++av) {
|
| if (av->a_type == AT_ENTRY) {
|
|
|