| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium 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 #include "native_client/src/include/elf32.h" | 7 #include "native_client/src/include/elf32.h" |
| 8 #include "native_client/src/include/elf_auxv.h" | 8 #include "native_client/src/include/elf_auxv.h" |
| 9 #include "native_client/src/include/nacl_macros.h" | 9 #include "native_client/src/include/nacl_macros.h" |
| 10 #include "native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h" | 10 #include "native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h" |
| 11 #include "native_client/src/untrusted/nacl/nacl_startup.h" | 11 #include "native_client/src/untrusted/nacl/nacl_startup.h" |
| 12 | 12 |
| 13 | 13 |
| 14 /* | 14 /* |
| 15 * This is the true entry point for untrusted code. | 15 * This is the true entry point for untrusted code. |
| 16 * See nacl_startup.h for the layout at the argument pointer. | 16 * See nacl_startup.h for the layout at the argument pointer. |
| 17 */ | 17 */ |
| 18 void _pnacl_wrapper_start(uint32_t *info) { | 18 void _pnacl_wrapper_start(uint32_t *info) { |
| 19 /* The PNaCl PPAPI shims are only needed on x86-64. */ |
| 20 #if defined(__x86_64__) |
| 19 Elf32_auxv_t *auxv = nacl_startup_auxv(info); | 21 Elf32_auxv_t *auxv = nacl_startup_auxv(info); |
| 20 | 22 |
| 21 Elf32_auxv_t *entry = NULL; | 23 Elf32_auxv_t *entry = NULL; |
| 22 for (Elf32_auxv_t *av = auxv; av->a_type != AT_NULL; ++av) { | 24 for (Elf32_auxv_t *av = auxv; av->a_type != AT_NULL; ++av) { |
| 23 if (av->a_type == AT_SYSINFO) { | 25 if (av->a_type == AT_SYSINFO) { |
| 24 entry = av; | 26 entry = av; |
| 25 break; | 27 break; |
| 26 } | 28 } |
| 27 } | 29 } |
| 28 | 30 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 | 43 |
| 42 /* If entry is NULL still allow startup to continue. It may be the case | 44 /* If entry is NULL still allow startup to continue. It may be the case |
| 43 * that the IRT was not actually used (e.g., for some commandline tests). | 45 * that the IRT was not actually used (e.g., for some commandline tests). |
| 44 * For newlib, we can tell that the IRT isn't used when libnacl_sys_private.a | 46 * For newlib, we can tell that the IRT isn't used when libnacl_sys_private.a |
| 45 * is in the bitcode link line. However, glibc does not use | 47 * is in the bitcode link line. However, glibc does not use |
| 46 * libnacl_sys_private, so that would not work. We could look for -lppapi | 48 * libnacl_sys_private, so that would not work. We could look for -lppapi |
| 47 * in the bitcode link line, but looking at the bitcode link line | 49 * in the bitcode link line, but looking at the bitcode link line |
| 48 * seems brittle (what if the bitcode link was separated from translation). | 50 * seems brittle (what if the bitcode link was separated from translation). |
| 49 * Thus we always wrap _start, even if there is no IRT auxv entry. | 51 * Thus we always wrap _start, even if there is no IRT auxv entry. |
| 50 */ | 52 */ |
| 53 #endif |
| 51 | 54 |
| 52 /* | 55 /* |
| 53 * Call the user entry point function. It should not return. | 56 * Call the user entry point function. It should not return. |
| 54 * TODO(sehr): Find a way to ensure this is invoked via a tail call. | 57 * TODO(sehr): Find a way to ensure this is invoked via a tail call. |
| 55 */ | 58 */ |
| 56 _start(info); | 59 _start(info); |
| 57 } | 60 } |
| OLD | NEW |