Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: src/untrusted/irt/irt_core_entry.c

Issue 19571003: IRT: Replace __attribute__((constructor)) with explicit call in _start() (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fix + cleanup Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/untrusted/irt/irt.gyp ('k') | src/untrusted/irt/irt_entry.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #include <unistd.h>
8
9 #include "native_client/src/shared/platform/nacl_log.h"
10 #include "native_client/src/shared/srpc/nacl_srpc.h"
11
12 /*
13 * This is declared as weak because plugin_main_nacl.cc on the
14 * Chromium side has a copy of IrtInit().
15 * TODO(mseaborn): Remove IrtInit() from there and use this copy.
16 */
17 __attribute__((weak))
18 int IrtInit(void) {
19 static int initialized = 0;
20 if (initialized) {
21 return 0;
22 }
23 if (!NaClSrpcModuleInit()) {
24 return 1;
25 }
26 NaClLogModuleInit(); /* Enable NaClLog'ing used by CHECK(). */
27 initialized = 1;
28 return 0;
29 }
30
31 static __attribute__((constructor)) void CallIrtInit(void) {
32 if (IrtInit()) {
33 static const char fatal_msg[] =
34 "irt initialization (IRTInit) failed.\n";
35 write(2, fatal_msg, sizeof(fatal_msg) - 1);
36 _exit(-1);
37 }
38 }
OLDNEW
« no previous file with comments | « src/untrusted/irt/irt.gyp ('k') | src/untrusted/irt/irt_entry.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698