OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
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 import os |
6 | 7 |
7 Import('env') | 8 Import('env') |
8 | 9 |
9 # This module shouldn't be built in an environment that uses glibc. | 10 # This module shouldn't be built in an environment that uses glibc. |
10 if env.Bit('nacl_glibc'): | 11 if env.Bit('nacl_glibc'): |
11 raise UserError('src/untrusted/irt/nacl.scons in the wrong environment?') | 12 raise UserError('src/untrusted/irt/nacl.scons in the wrong environment?') |
12 | 13 |
13 blob_env = env.Clone() | 14 blob_env = env.Clone() |
14 blob_env.Append(LINKFLAGS='-Wl,--section-start,.rodata=${IRT_BLOB_DATA_START}') | 15 blob_env.Append(LINKFLAGS='-Wl,--section-start,.rodata=${IRT_BLOB_DATA_START}') |
15 # The PNaCl linker (gold) does not implement the "-Ttext-segment" | 16 # The PNaCl linker (gold) does not implement the "-Ttext-segment" |
16 # option. However, with the linker for x86, the "-Ttext" option does | 17 # option. However, with the linker for x86, the "-Ttext" option does |
17 # not affect the executable's base address. | 18 # not affect the executable's base address. |
18 if blob_env.Bit('bitcode'): | 19 if blob_env.Bit('bitcode'): |
19 blob_env.Append(LINKFLAGS='-Wl,-Ttext=${IRT_BLOB_CODE_START}') | 20 blob_env.Append(LINKFLAGS='-Wl,-Ttext=${IRT_BLOB_CODE_START}') |
20 else: | 21 else: |
21 blob_env.Append(LINKFLAGS='-Wl,-Ttext-segment=${IRT_BLOB_CODE_START}') | 22 blob_env.Append(LINKFLAGS='-Wl,-Ttext-segment=${IRT_BLOB_CODE_START}') |
22 | 23 |
| 24 # We may want to move this into ppruntime in the future to limit |
| 25 # visibility to ppapi/generators |
| 26 def GetPNaClShimSource(env): |
| 27 if not env.Bit('target_x86_64'): |
| 28 return 'shim_dummy.c' |
| 29 |
| 30 # Generate a 'pnacl_shim.c' |
| 31 # api code |
| 32 api_glob = env.Glob('${SOURCE_ROOT}/ppapi/api/*.idl') |
| 33 api_dev_glob = env.Glob('${SOURCE_ROOT}/ppapi/api/dev/*.idl') |
| 34 all_api = [f.abspath for f in api_glob + api_dev_glob] |
| 35 # python code |
| 36 generators_glob = env.Glob('${SOURCE_ROOT}/ppapi/generators/*.py') |
| 37 return env.Command( |
| 38 'pnacl_irt_shim.c', |
| 39 (api_glob + api_dev_glob + generators_glob), |
| 40 ('${PYTHON} ' + |
| 41 '${SOURCE_ROOT}/ppapi/generators/generator.py ' + |
| 42 '--srcroot=' + os.path.join('${SOURCE_ROOT}', 'ppapi', 'api') + ' ' + |
| 43 '--wnone --pnacl --pnaclshim=${TARGETS} ' + ' '.join(all_api))) |
| 44 |
| 45 irt_shim_obj = blob_env.ComponentObject(GetPNaClShimSource(blob_env)) |
| 46 |
23 irt_support_sources = [ | 47 irt_support_sources = [ |
24 'irt_malloc.c', | 48 'irt_malloc.c', |
25 'irt_private_pthread.c', | 49 'irt_private_pthread.c', |
26 'irt_private_tls.c', | 50 'irt_private_tls.c', |
27 ] | 51 ] |
28 | 52 |
29 irt_entry_obj = blob_env.ComponentObject('irt_entry.c') | 53 irt_entry_obj = blob_env.ComponentObject('irt_entry.c') |
30 | 54 |
31 # NACL_GC_WRAP_SYSCALL uses ({...}) syntax. | 55 # NACL_GC_WRAP_SYSCALL uses ({...}) syntax. |
32 blob_env.FilterOut(CCFLAGS=['-pedantic']) | 56 blob_env.FilterOut(CCFLAGS=['-pedantic']) |
33 | 57 |
34 irt_common_interfaces = [ | 58 irt_common_interfaces = [ |
35 'irt_basic.c', | 59 'irt_basic.c', |
36 'irt_fdio.c', | 60 'irt_fdio.c', |
37 'irt_filename.c', | 61 'irt_filename.c', |
38 'irt_memory.c', | 62 'irt_memory.c', |
39 'irt_dyncode.c', | 63 'irt_dyncode.c', |
40 'irt_thread.c', | 64 'irt_thread.c', |
41 'irt_mutex.c', | 65 'irt_mutex.c', |
42 'irt_cond.c', | 66 'irt_cond.c', |
43 'irt_sem.c', | 67 'irt_sem.c', |
44 'irt_tls.c', | 68 'irt_tls.c', |
45 'irt_blockhook.c', | 69 'irt_blockhook.c', |
46 'irt_clock.c', | 70 'irt_clock.c', |
| 71 'irt_control.c', |
47 'irt_dev_exception_handling.c', | 72 'irt_dev_exception_handling.c', |
48 ] | 73 ] |
49 | 74 |
50 # These are the objects and libraries that go into every IRT image. | 75 # These are the objects and libraries that go into every IRT image. |
51 irt_support_objs = [blob_env.ComponentObject(x) for x in | 76 irt_support_objs = [blob_env.ComponentObject(x) for x in |
52 (irt_support_sources + irt_common_interfaces)] | 77 (irt_support_sources + irt_common_interfaces)] |
53 | 78 |
54 # We also get nc_init_private.c, nc_thread.c and nc_tsd.c via | 79 # We also get nc_init_private.c, nc_thread.c and nc_tsd.c via |
55 # #includes of .c files. | 80 # #includes of .c files. |
56 irt_support_objs += [ | 81 irt_support_objs += [ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 irt_browser = ['irt_interfaces_ppapi.c', | 118 irt_browser = ['irt_interfaces_ppapi.c', |
94 'irt_entry_ppapi.c', | 119 'irt_entry_ppapi.c', |
95 'irt_ppapi.c', | 120 'irt_ppapi.c', |
96 'irt_manifest.c', | 121 'irt_manifest.c', |
97 'irt_nameservice.c', | 122 'irt_nameservice.c', |
98 'irt_random.c', | 123 'irt_random.c', |
99 ] | 124 ] |
100 | 125 |
101 def LinkIrt(output, files, libs): | 126 def LinkIrt(output, files, libs): |
102 return blob_env.ComponentProgram(output, | 127 return blob_env.ComponentProgram(output, |
103 [irt_entry_obj] + irt_support_objs + files, | 128 [irt_entry_obj, irt_shim_obj] + |
| 129 irt_support_objs + files, |
104 EXTRA_LIBS=libs) | 130 EXTRA_LIBS=libs) |
105 | 131 |
106 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) | 132 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) |
107 irt_library = LinkIrt('irt', irt_browser, ['ppruntime', | 133 irt_library = LinkIrt('irt', irt_browser, ['ppruntime', |
108 'srpc', | 134 'srpc', |
109 'imc_syscalls', | 135 'imc_syscalls', |
110 'platform', | 136 'platform', |
111 'gio', | 137 'gio', |
112 'm']) | 138 'm']) |
113 | 139 |
(...skipping 29 matching lines...) Expand all Loading... |
143 # Holy cow it takes over 30 seconds to disassemble | 169 # Holy cow it takes over 30 seconds to disassemble |
144 # the ARM irt.nexe. Set test size to 'large'. | 170 # the ARM irt.nexe. Set test size to 'large'. |
145 size='large') | 171 size='large') |
146 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') | 172 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') |
147 node = env.CommandTest('irt_core_tls_test.out', | 173 node = env.CommandTest('irt_core_tls_test.out', |
148 ['${PYTHON}', env.File('check_tls.py'), | 174 ['${PYTHON}', env.File('check_tls.py'), |
149 check_tls_arch, '${OBJDUMP}', irt_core_library], | 175 check_tls_arch, '${OBJDUMP}', irt_core_library], |
150 # don't run ${PYTHON} under the emulator. | 176 # don't run ${PYTHON} under the emulator. |
151 direct_emulation=False) | 177 direct_emulation=False) |
152 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') | 178 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') |
OLD | NEW |