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 * This is a standalone program that loads and runs the dynamic linker. | 6 * This is a standalone program that loads and runs the dynamic linker. |
7 * This program itself must be linked statically. To keep it small, it's | 7 * This program itself must be linked statically. To keep it small, it's |
8 * written to avoid all dependencies on libc and standard startup code. | 8 * written to avoid all dependencies on libc and standard startup code. |
9 * Hence, this should be linked using -nostartfiles. It must be compiled | 9 * Hence, this should be linked using -nostartfiles. It must be compiled |
10 * with -fno-stack-protector to ensure the compiler won't emit code that | 10 * with -fno-stack-protector to ensure the compiler won't emit code that |
11 * presumes some special setup has been done. | 11 * presumes some special setup has been done. |
12 * | 12 * |
13 * On ARM, the compiler will emit calls to some libc functions, so we | 13 * On ARM, the compiler will emit calls to some libc functions, so we |
14 * cannot link with -nostdlib. The functions it does use (memset and | 14 * cannot link with -nostdlib. The functions it does use (memset and |
15 * __aeabi_* functions for integer division) are sufficiently small and | 15 * __aeabi_* functions for integer division) are sufficiently small and |
16 * self-contained in ARM's libc.a that we don't have any problem using | 16 * self-contained in ARM's libc.a that we don't have any problem using |
17 * the libc definitions though we aren't using the rest of libc or doing | 17 * the libc definitions though we aren't using the rest of libc or doing |
18 * any of the setup it might expect. | 18 * any of the setup it might expect. |
19 */ | 19 */ |
20 #include <elf.h> | 20 #include <elf.h> |
21 #include <fcntl.h> | 21 #include <fcntl.h> |
22 #include <limits.h> | 22 #include <limits.h> |
23 #include <link.h> | 23 #include <link.h> |
24 #include <stddef.h> | 24 #include <stddef.h> |
25 #include <stdint.h> | 25 #include <stdint.h> |
26 #include <sys/mman.h> | 26 #include <sys/mman.h> |
27 | 27 |
| 28 #include "native_client/src/include/nacl_defines.h" |
| 29 |
28 /* | 30 /* |
29 * Get inline functions for system calls. | 31 * Get inline functions for system calls. |
30 */ | 32 */ |
31 static int my_errno; | 33 static int my_errno; |
32 #define SYS_ERRNO my_errno | 34 #define SYS_ERRNO my_errno |
33 #include "third_party/lss/linux_syscall_support.h" | 35 #include "third_party/lss/linux_syscall_support.h" |
34 | 36 |
35 #define MAX_PHNUM 12 | 37 #define MAX_PHNUM 12 |
36 | 38 |
37 typedef uintptr_t __attribute__((may_alias)) stack_val_t; | 39 typedef uintptr_t __attribute__((may_alias)) stack_val_t; |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 721 |
720 #if defined(__arm__) | 722 #if defined(__arm__) |
721 /* | 723 /* |
722 * We may bring in __aeabi_* functions from libgcc that in turn | 724 * We may bring in __aeabi_* functions from libgcc that in turn |
723 * want to call raise. | 725 * want to call raise. |
724 */ | 726 */ |
725 int raise(int sig) { | 727 int raise(int sig) { |
726 return sys_kill(sys_getpid(), sig); | 728 return sys_kill(sys_getpid(), sig); |
727 } | 729 } |
728 #endif | 730 #endif |
OLD | NEW |