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}', |
| 16 # TODO(robertm): This define should be removed once |
| 17 # the IRT shim build has migrated to the Chrome tree. |
| 18 CPPDEFINES=['ENABLE_NACL_IRT_PPAPIHOOK_SHIMMED']) |
| 19 |
15 # The PNaCl linker (gold) does not implement the "-Ttext-segment" | 20 # The PNaCl linker (gold) does not implement the "-Ttext-segment" |
16 # option. However, with the linker for x86, the "-Ttext" option does | 21 # option. However, with the linker for x86, the "-Ttext" option does |
17 # not affect the executable's base address. | 22 # not affect the executable's base address. |
18 if blob_env.Bit('bitcode'): | 23 if blob_env.Bit('bitcode'): |
19 blob_env.Append(LINKFLAGS='-Wl,-Ttext=${IRT_BLOB_CODE_START}') | 24 blob_env.Append(LINKFLAGS='-Wl,-Ttext=${IRT_BLOB_CODE_START}') |
20 # allow use of asm in irt_thread.c and irt_private_pthread.c | 25 # allow use of asm in irt_thread.c and irt_private_pthread.c |
21 # TODO(robertm): get rid of this once we can distinguish | 26 # TODO(robertm): get rid of this once we can distinguish |
22 # real asms from those used for redirects. | 27 # real asms from those used for redirects. |
23 # In this case: asm("llvm.nacl.tp.tdb.offset") | 28 # In this case: asm("llvm.nacl.tp.tdb.offset") |
24 # from src/untrusted/nacl/tls_params.h | 29 # from src/untrusted/nacl/tls_params.h |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 'irt_manifest.c', | 110 'irt_manifest.c', |
106 ] | 111 ] |
107 | 112 |
108 irt_libs = ['srpc', | 113 irt_libs = ['srpc', |
109 'imc_syscalls', | 114 'imc_syscalls', |
110 'platform', | 115 'platform', |
111 'gio', | 116 'gio', |
112 'm', | 117 'm', |
113 ] | 118 ] |
114 | 119 |
| 120 # We may want to move this into ppruntime in the future to limit |
| 121 # visibility to ppapi/generators |
| 122 def GetPNaClShimSource(env): |
| 123 if not env.Bit('target_x86_64'): |
| 124 return 'shim_dummy.c' |
| 125 |
| 126 # Generate a 'pnacl_shim.c' |
| 127 # API code |
| 128 api_glob = env.Glob('${SOURCE_ROOT}/ppapi/api/*.idl') |
| 129 api_dev_glob = env.Glob('${SOURCE_ROOT}/ppapi/api/dev/*.idl') |
| 130 all_api = [f.abspath for f in api_glob + api_dev_glob] |
| 131 # Python code |
| 132 generators_glob = env.Glob('${SOURCE_ROOT}/ppapi/generators/*.py') |
| 133 return env.Command( |
| 134 'pnacl_irt_shim.c', |
| 135 (api_glob + api_dev_glob + generators_glob), |
| 136 ('${PYTHON} ' + |
| 137 '${SOURCE_ROOT}/ppapi/generators/generator.py ' + |
| 138 '--srcroot=' + os.path.join('${SOURCE_ROOT}', 'ppapi', 'api') + ' ' + |
| 139 '--wnone --pnacl --pnaclshim=${TARGETS} ' + ' '.join(all_api))) |
| 140 |
| 141 irt_shim_obj = blob_env.ComponentObject(GetPNaClShimSource(blob_env)) |
| 142 |
| 143 |
115 def LinkIrt(output, files, libs): | 144 def LinkIrt(output, files, libs): |
116 return blob_env.ComponentProgram(output, | 145 return blob_env.ComponentProgram(output, |
117 [irt_entry_obj] + irt_support_objs + files, | 146 [irt_entry_obj, irt_shim_obj] + |
| 147 irt_support_objs + files, |
118 EXTRA_LIBS=libs + irt_libs) | 148 EXTRA_LIBS=libs + irt_libs) |
119 | 149 |
120 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) | 150 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) |
121 irt_library = LinkIrt('irt', irt_browser, ['ppruntime']) | 151 irt_library = LinkIrt('irt', irt_browser, ['ppruntime']) |
122 | 152 |
123 env.SDKInstallBin('irt_core.nexe', irt_core_library) | 153 env.SDKInstallBin('irt_core.nexe', irt_core_library) |
124 env.SDKInstallBin('irt.nexe', irt_library) | 154 env.SDKInstallBin('irt.nexe', irt_library) |
125 | 155 |
126 # TODO(mcgrathr): these should be installed, but scons is a mystery | 156 # TODO(mcgrathr): these should be installed, but scons is a mystery |
127 #env.AddHeaderToSdk(['irt.h']) | 157 #env.AddHeaderToSdk(['irt.h']) |
(...skipping 24 matching lines...) Expand all Loading... |
152 # Holy cow it takes over 30 seconds to disassemble | 182 # Holy cow it takes over 30 seconds to disassemble |
153 # the ARM irt.nexe. Set test size to 'large'. | 183 # the ARM irt.nexe. Set test size to 'large'. |
154 size='large') | 184 size='large') |
155 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') | 185 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') |
156 node = env.CommandTest('irt_core_tls_test.out', | 186 node = env.CommandTest('irt_core_tls_test.out', |
157 ['${PYTHON}', env.File('check_tls.py'), | 187 ['${PYTHON}', env.File('check_tls.py'), |
158 check_tls_arch, '${OBJDUMP}', irt_core_library], | 188 check_tls_arch, '${OBJDUMP}', irt_core_library], |
159 # don't run ${PYTHON} under the emulator. | 189 # don't run ${PYTHON} under the emulator. |
160 direct_emulation=False) | 190 direct_emulation=False) |
161 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') | 191 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') |
OLD | NEW |