OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 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 | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * NaCl Simple/secure ELF loader (NaCl SEL). | 8 * NaCl Simple/secure ELF loader (NaCl SEL). |
9 */ | 9 */ |
10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "native_client/src/trusted/perf_counter/nacl_perf_counter.h" | 37 #include "native_client/src/trusted/perf_counter/nacl_perf_counter.h" |
38 #include "native_client/src/trusted/service_runtime/env_cleanser.h" | 38 #include "native_client/src/trusted/service_runtime/env_cleanser.h" |
39 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" | 39 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
40 #include "native_client/src/trusted/service_runtime/nacl_app.h" | 40 #include "native_client/src/trusted/service_runtime/nacl_app.h" |
41 #include "native_client/src/trusted/service_runtime/nacl_all_modules.h" | 41 #include "native_client/src/trusted/service_runtime/nacl_all_modules.h" |
42 #include "native_client/src/trusted/service_runtime/nacl_debug_init.h" | 42 #include "native_client/src/trusted/service_runtime/nacl_debug_init.h" |
43 #include "native_client/src/trusted/service_runtime/nacl_error_log_hook.h" | 43 #include "native_client/src/trusted/service_runtime/nacl_error_log_hook.h" |
44 #include "native_client/src/trusted/service_runtime/nacl_globals.h" | 44 #include "native_client/src/trusted/service_runtime/nacl_globals.h" |
45 #include "native_client/src/trusted/service_runtime/nacl_signal.h" | 45 #include "native_client/src/trusted/service_runtime/nacl_signal.h" |
46 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" | 46 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" |
47 #include "native_client/src/trusted/service_runtime/nacl_text.h" | |
47 #include "native_client/src/trusted/service_runtime/nacl_valgrind_hooks.h" | 48 #include "native_client/src/trusted/service_runtime/nacl_valgrind_hooks.h" |
48 #include "native_client/src/trusted/service_runtime/osx/mach_exception_handler.h " | 49 #include "native_client/src/trusted/service_runtime/osx/mach_exception_handler.h " |
49 #include "native_client/src/trusted/service_runtime/outer_sandbox.h" | 50 #include "native_client/src/trusted/service_runtime/outer_sandbox.h" |
50 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 51 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
51 #include "native_client/src/trusted/service_runtime/sel_qualify.h" | 52 #include "native_client/src/trusted/service_runtime/sel_qualify.h" |
52 #include "native_client/src/trusted/service_runtime/win/exception_patch/ntdll_pa tch.h" | 53 #include "native_client/src/trusted/service_runtime/win/exception_patch/ntdll_pa tch.h" |
53 #if NACL_WINDOWS | 54 #if NACL_WINDOWS |
54 #include "native_client/src/trusted/service_runtime/win/debug_exception_handler. h" | 55 #include "native_client/src/trusted/service_runtime/win/debug_exception_handler. h" |
55 #endif | 56 #endif |
56 | 57 |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 fprintf(stderr, "NaClAppPrepareToLaunch returned %d", errcode); | 672 fprintf(stderr, "NaClAppPrepareToLaunch returned %d", errcode); |
672 } | 673 } |
673 NaClPerfCounterMark(&time_all_main, "AppPrepLaunch"); | 674 NaClPerfCounterMark(&time_all_main, "AppPrepLaunch"); |
674 NaClPerfCounterIntervalLast(&time_all_main); | 675 NaClPerfCounterIntervalLast(&time_all_main); |
675 } | 676 } |
676 | 677 |
677 /* Give debuggers a well known point at which xlate_base is known. */ | 678 /* Give debuggers a well known point at which xlate_base is known. */ |
678 NaClGdbHook(&state); | 679 NaClGdbHook(&state); |
679 } | 680 } |
680 | 681 |
681 | |
682 if (NULL != blob_library_file) { | 682 if (NULL != blob_library_file) { |
683 if (LOAD_OK == errcode) { | 683 if (LOAD_OK == errcode) { |
684 NaClLog(2, "Loading blob file %s\n", blob_library_file); | 684 if (NaClHasSegmentGapForDyncode(nap)) { |
685 errcode = NaClAppLoadFileDynamically(nap, (struct Gio *) &blob_file); | 685 NaClLog(2, "Loading blob file %s\n", blob_library_file); |
686 if (LOAD_OK != errcode) { | 686 errcode = NaClAppLoadFileDynamically(nap, (struct Gio *) &blob_file); |
687 fprintf(stderr, "Error while loading \"%s\": %s\n", | 687 if (LOAD_OK != errcode) { |
688 blob_library_file, | 688 fprintf(stderr, "Error while loading \"%s\": %s\n", |
689 NaClErrorString(errcode)); | 689 blob_library_file, |
690 NaClErrorString(errcode)); | |
691 } | |
692 NaClPerfCounterMark(&time_all_main, "BlobLoaded"); | |
693 NaClPerfCounterIntervalLast(&time_all_main); | |
694 } else { | |
695 fprintf( | |
Mark Seaborn
2012/06/28 22:05:11
Can you use NaClLog() instead of fprintf(), please
jvoung (off chromium)
2012/06/28 22:41:56
Done. The other code around here used fprintf for
| |
696 stderr, | |
697 "WARNING: NaCl app doesn't have a segment gap, not loading IRT.\n" | |
698 "This is expected for PNaCl's translator nexes.\n"); | |
690 } | 699 } |
691 NaClPerfCounterMark(&time_all_main, "BlobLoaded"); | |
692 NaClPerfCounterIntervalLast(&time_all_main); | |
693 } | 700 } |
694 | 701 |
695 if (-1 == (*((struct Gio *) &blob_file)->vtbl->Close)((struct Gio *) | 702 if (-1 == (*((struct Gio *) &blob_file)->vtbl->Close)((struct Gio *) |
696 &blob_file)) { | 703 &blob_file)) { |
697 fprintf(stderr, "Error while closing \"%s\".\n", blob_library_file); | 704 fprintf(stderr, "Error while closing \"%s\".\n", blob_library_file); |
698 } | 705 } |
699 (*((struct Gio *) &blob_file)->vtbl->Dtor)((struct Gio *) &blob_file); | 706 (*((struct Gio *) &blob_file)->vtbl->Dtor)((struct Gio *) &blob_file); |
700 if (verbosity) { | 707 if (verbosity) { |
701 gprintf((struct Gio *) &gout, "printing post-IRT NaClApp details\n"); | 708 gprintf((struct Gio *) &gout, "printing post-IRT NaClApp details\n"); |
702 NaClAppPrintDetails(nap, (struct Gio *) &gout); | 709 NaClAppPrintDetails(nap, (struct Gio *) &gout); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 fflush(stdout); | 880 fflush(stdout); |
874 | 881 |
875 if (handle_signals) NaClSignalHandlerFini(); | 882 if (handle_signals) NaClSignalHandlerFini(); |
876 NaClAllModulesFini(); | 883 NaClAllModulesFini(); |
877 | 884 |
878 NaClExit(ret_code); | 885 NaClExit(ret_code); |
879 | 886 |
880 /* Unreachable, but having the return prevents a compiler error. */ | 887 /* Unreachable, but having the return prevents a compiler error. */ |
881 return ret_code; | 888 return ret_code; |
882 } | 889 } |
OLD | NEW |