| 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 fprintf(stderr, "NaClAppPrepareToLaunch returned %d", errcode); | 671 fprintf(stderr, "NaClAppPrepareToLaunch returned %d", errcode); |
| 672 } | 672 } |
| 673 NaClPerfCounterMark(&time_all_main, "AppPrepLaunch"); | 673 NaClPerfCounterMark(&time_all_main, "AppPrepLaunch"); |
| 674 NaClPerfCounterIntervalLast(&time_all_main); | 674 NaClPerfCounterIntervalLast(&time_all_main); |
| 675 } | 675 } |
| 676 | 676 |
| 677 /* Give debuggers a well known point at which xlate_base is known. */ | 677 /* Give debuggers a well known point at which xlate_base is known. */ |
| 678 NaClGdbHook(&state); | 678 NaClGdbHook(&state); |
| 679 } | 679 } |
| 680 | 680 |
| 681 | |
| 682 if (NULL != blob_library_file) { | 681 if (NULL != blob_library_file) { |
| 683 if (LOAD_OK == errcode) { | 682 if (LOAD_OK == errcode) { |
| 684 NaClLog(2, "Loading blob file %s\n", blob_library_file); | 683 if (NULL != nap->text_shm) { |
| 685 errcode = NaClAppLoadFileDynamically(nap, (struct Gio *) &blob_file); | 684 NaClLog(2, "Loading blob file %s\n", blob_library_file); |
| 686 if (LOAD_OK != errcode) { | 685 errcode = NaClAppLoadFileDynamically(nap, (struct Gio *) &blob_file); |
| 687 fprintf(stderr, "Error while loading \"%s\": %s\n", | 686 if (LOAD_OK != errcode) { |
| 688 blob_library_file, | 687 fprintf(stderr, "Error while loading \"%s\": %s\n", |
| 689 NaClErrorString(errcode)); | 688 blob_library_file, |
| 689 NaClErrorString(errcode)); |
| 690 } |
| 691 NaClPerfCounterMark(&time_all_main, "BlobLoaded"); |
| 692 NaClPerfCounterIntervalLast(&time_all_main); |
| 693 } else { |
| 694 /* |
| 695 * TODO(mseaborn): Omit -B when the IRT is not wanted (e.g., from |
| 696 * sel_ldr_launcher_standalone), instead of looking for the absence |
| 697 * of a segment gap, when the nexe does not follow NaCl's stable ABI. |
| 698 */ |
| 699 NaClLog(LOG_WARNING, |
| 700 "Main executable has no segment gap; not loading IRT library. " |
| 701 "This is expected for PNaCl's translator nexes.\n"); |
| 690 } | 702 } |
| 691 NaClPerfCounterMark(&time_all_main, "BlobLoaded"); | |
| 692 NaClPerfCounterIntervalLast(&time_all_main); | |
| 693 } | 703 } |
| 694 | 704 |
| 695 if (-1 == (*((struct Gio *) &blob_file)->vtbl->Close)((struct Gio *) | 705 if (-1 == (*((struct Gio *) &blob_file)->vtbl->Close)((struct Gio *) |
| 696 &blob_file)) { | 706 &blob_file)) { |
| 697 fprintf(stderr, "Error while closing \"%s\".\n", blob_library_file); | 707 fprintf(stderr, "Error while closing \"%s\".\n", blob_library_file); |
| 698 } | 708 } |
| 699 (*((struct Gio *) &blob_file)->vtbl->Dtor)((struct Gio *) &blob_file); | 709 (*((struct Gio *) &blob_file)->vtbl->Dtor)((struct Gio *) &blob_file); |
| 700 if (verbosity) { | 710 if (verbosity) { |
| 701 gprintf((struct Gio *) &gout, "printing post-IRT NaClApp details\n"); | 711 gprintf((struct Gio *) &gout, "printing post-IRT NaClApp details\n"); |
| 702 NaClAppPrintDetails(nap, (struct Gio *) &gout); | 712 NaClAppPrintDetails(nap, (struct Gio *) &gout); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 fflush(stdout); | 883 fflush(stdout); |
| 874 | 884 |
| 875 if (handle_signals) NaClSignalHandlerFini(); | 885 if (handle_signals) NaClSignalHandlerFini(); |
| 876 NaClAllModulesFini(); | 886 NaClAllModulesFini(); |
| 877 | 887 |
| 878 NaClExit(ret_code); | 888 NaClExit(ret_code); |
| 879 | 889 |
| 880 /* Unreachable, but having the return prevents a compiler error. */ | 890 /* Unreachable, but having the return prevents a compiler error. */ |
| 881 return ret_code; | 891 return ret_code; |
| 882 } | 892 } |
| OLD | NEW |