| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 * NaClCreateMemoryObject() which opens a file in /tmp. | 718 * NaClCreateMemoryObject() which opens a file in /tmp. |
| 719 * | 719 * |
| 720 * We cannot enable the sandbox if file access is enabled. | 720 * We cannot enable the sandbox if file access is enabled. |
| 721 */ | 721 */ |
| 722 if (!NaClAclBypassChecks && g_enable_outer_sandbox_func != NULL) { | 722 if (!NaClAclBypassChecks && g_enable_outer_sandbox_func != NULL) { |
| 723 g_enable_outer_sandbox_func(); | 723 g_enable_outer_sandbox_func(); |
| 724 } | 724 } |
| 725 | 725 |
| 726 if (NULL != blob_library_file) { | 726 if (NULL != blob_library_file) { |
| 727 if (LOAD_OK == errcode) { | 727 if (LOAD_OK == errcode) { |
| 728 if (NULL != nap->text_shm) { | 728 NaClLog(2, "Loading blob file %s\n", blob_library_file); |
| 729 NaClLog(2, "Loading blob file %s\n", blob_library_file); | 729 errcode = NaClAppLoadFileDynamically(nap, (struct Gio *) &blob_file); |
| 730 errcode = NaClAppLoadFileDynamically(nap, (struct Gio *) &blob_file); | 730 if (LOAD_OK != errcode) { |
| 731 if (LOAD_OK != errcode) { | 731 fprintf(stderr, "Error while loading \"%s\": %s\n", |
| 732 fprintf(stderr, "Error while loading \"%s\": %s\n", | 732 blob_library_file, |
| 733 blob_library_file, | 733 NaClErrorString(errcode)); |
| 734 NaClErrorString(errcode)); | |
| 735 } | |
| 736 NaClPerfCounterMark(&time_all_main, "BlobLoaded"); | |
| 737 NaClPerfCounterIntervalLast(&time_all_main); | |
| 738 } else { | |
| 739 /* | |
| 740 * TODO(mseaborn): Omit -B when the IRT is not wanted (e.g., from | |
| 741 * sel_ldr_launcher_standalone), instead of looking for the absence | |
| 742 * of a segment gap, when the nexe does not follow NaCl's stable ABI. | |
| 743 */ | |
| 744 NaClLog(LOG_WARNING, | |
| 745 "Main executable has no segment gap; not loading IRT library. " | |
| 746 "This is expected for PNaCl's translator nexes.\n"); | |
| 747 } | 734 } |
| 735 NaClPerfCounterMark(&time_all_main, "BlobLoaded"); |
| 736 NaClPerfCounterIntervalLast(&time_all_main); |
| 748 } | 737 } |
| 749 | 738 |
| 750 if (-1 == (*((struct Gio *) &blob_file)->vtbl->Close)((struct Gio *) | 739 if (-1 == (*((struct Gio *) &blob_file)->vtbl->Close)((struct Gio *) |
| 751 &blob_file)) { | 740 &blob_file)) { |
| 752 fprintf(stderr, "Error while closing \"%s\".\n", blob_library_file); | 741 fprintf(stderr, "Error while closing \"%s\".\n", blob_library_file); |
| 753 } | 742 } |
| 754 (*((struct Gio *) &blob_file)->vtbl->Dtor)((struct Gio *) &blob_file); | 743 (*((struct Gio *) &blob_file)->vtbl->Dtor)((struct Gio *) &blob_file); |
| 755 if (verbosity) { | 744 if (verbosity) { |
| 756 gprintf((struct Gio *) &gout, "printing post-IRT NaClApp details\n"); | 745 gprintf((struct Gio *) &gout, "printing post-IRT NaClApp details\n"); |
| 757 NaClAppPrintDetails(nap, (struct Gio *) &gout); | 746 NaClAppPrintDetails(nap, (struct Gio *) &gout); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 fflush(stdout); | 860 fflush(stdout); |
| 872 | 861 |
| 873 if (handle_signals) NaClSignalHandlerFini(); | 862 if (handle_signals) NaClSignalHandlerFini(); |
| 874 NaClAllModulesFini(); | 863 NaClAllModulesFini(); |
| 875 | 864 |
| 876 NaClExit(ret_code); | 865 NaClExit(ret_code); |
| 877 | 866 |
| 878 /* Unreachable, but having the return prevents a compiler error. */ | 867 /* Unreachable, but having the return prevents a compiler error. */ |
| 879 return ret_code; | 868 return ret_code; |
| 880 } | 869 } |
| OLD | NEW |