OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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 <stdlib.h> |
| 8 #include <unistd.h> |
| 9 |
| 10 #include "native_client/src/include/elf32.h" |
| 11 #include "native_client/src/untrusted/nacl/nacl_irt.h" |
| 12 #include "native_client/src/untrusted/nacl/start.h" |
| 13 #include "native_client/src/untrusted/nacl/tls.h" |
| 14 |
| 15 |
| 16 /* |
| 17 * Provide dummy definitions of _init() and _fini() because they are |
| 18 * referenced by libc.a's __libc_init_array(), which we do not use in this |
| 19 * context. |
| 20 */ |
| 21 |
| 22 void _init(void) { |
| 23 abort(); |
| 24 } |
| 25 |
| 26 void _fini(void) { |
| 27 abort(); |
| 28 } |
| 29 |
| 30 /* |
| 31 * Provide dummy definitions of the TLS layout functions because they are |
| 32 * referenced by libnacl.a's tls.c, which we do not use in this context. |
| 33 */ |
| 34 |
| 35 ptrdiff_t __nacl_tp_tls_offset(size_t tls_size) { |
| 36 abort(); |
| 37 } |
| 38 |
| 39 ptrdiff_t __nacl_tp_tdb_offset(size_t tdb_size) { |
| 40 abort(); |
| 41 } |
| 42 |
| 43 void __libc_start(int argc, char **argv, char **envp, Elf32_auxv_t *auxv) { |
| 44 environ = envp; |
| 45 |
| 46 __libnacl_irt_init(auxv); |
| 47 |
| 48 /* |
| 49 * We don't support TLS or pthreads yet, so we skip |
| 50 * __pthread_initialize() for now. |
| 51 */ |
| 52 __newlib_thread_init(); |
| 53 |
| 54 exit(main(argc, argv, envp)); |
| 55 |
| 56 __builtin_trap(); |
| 57 } |
OLD | NEW |