OLD | NEW |
---|---|
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright 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): | |
Mark Seaborn
2012/08/28 15:51:20
Please put this lower in the file, just before Lin
Robert Muth (chromium)
2012/08/28 18:13:30
Done.
| |
27 if not env.Bit('target_x86_64'): | |
28 return 'shim_dummy.c' | |
29 | |
30 # Generate a 'pnacl_shim.c' | |
31 # api code | |
Mark Seaborn
2012/08/28 15:51:20
Capitalise: "API code"
Robert Muth (chromium)
2012/08/28 18:13:30
Done.
| |
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 | |
Mark Seaborn
2012/08/28 15:51:20
Capitalise as "Python", please
Robert Muth (chromium)
2012/08/28 18:13:30
Done.
| |
36 generators_glob = env.Glob('${SOURCE_ROOT}/ppapi/generators/*.py') | |
37 return env.Command( | |
38 'pnacl_irt_shim.c', | |
Mark Seaborn
2012/08/28 15:51:20
Nit: our Python style is that arguments are indent
Robert Muth (chromium)
2012/08/28 18:13:30
Done.
| |
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)) | |
Mark Seaborn
2012/08/28 15:51:20
I don't think you need ComponentObject() here, do
Robert Muth (chromium)
2012/08/28 18:13:30
IIRC there was some strange python issue where aut
| |
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']) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 125 |
102 irt_libs = ['srpc', | 126 irt_libs = ['srpc', |
103 'imc_syscalls', | 127 'imc_syscalls', |
104 'platform', | 128 'platform', |
105 'gio', | 129 'gio', |
106 'm', | 130 'm', |
107 ] | 131 ] |
108 | 132 |
109 def LinkIrt(output, files, libs): | 133 def LinkIrt(output, files, libs): |
110 return blob_env.ComponentProgram(output, | 134 return blob_env.ComponentProgram(output, |
111 [irt_entry_obj] + irt_support_objs + files, | 135 [irt_entry_obj, irt_shim_obj] + |
136 irt_support_objs + files, | |
112 EXTRA_LIBS=libs + irt_libs) | 137 EXTRA_LIBS=libs + irt_libs) |
113 | 138 |
114 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) | 139 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) |
115 irt_library = LinkIrt('irt', irt_browser, ['ppruntime']) | 140 irt_library = LinkIrt('irt', irt_browser, ['ppruntime']) |
116 | 141 |
117 env.SDKInstallBin('irt_core.nexe', irt_core_library) | 142 env.SDKInstallBin('irt_core.nexe', irt_core_library) |
118 env.SDKInstallBin('irt.nexe', irt_library) | 143 env.SDKInstallBin('irt.nexe', irt_library) |
119 | 144 |
120 # TODO(mcgrathr): these should be installed, but scons is a mystery | 145 # TODO(mcgrathr): these should be installed, but scons is a mystery |
121 #env.AddHeaderToSdk(['irt.h']) | 146 #env.AddHeaderToSdk(['irt.h']) |
(...skipping 24 matching lines...) Expand all Loading... | |
146 # Holy cow it takes over 30 seconds to disassemble | 171 # Holy cow it takes over 30 seconds to disassemble |
147 # the ARM irt.nexe. Set test size to 'large'. | 172 # the ARM irt.nexe. Set test size to 'large'. |
148 size='large') | 173 size='large') |
149 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') | 174 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') |
150 node = env.CommandTest('irt_core_tls_test.out', | 175 node = env.CommandTest('irt_core_tls_test.out', |
151 ['${PYTHON}', env.File('check_tls.py'), | 176 ['${PYTHON}', env.File('check_tls.py'), |
152 check_tls_arch, '${OBJDUMP}', irt_core_library], | 177 check_tls_arch, '${OBJDUMP}', irt_core_library], |
153 # don't run ${PYTHON} under the emulator. | 178 # don't run ${PYTHON} under the emulator. |
154 direct_emulation=False) | 179 direct_emulation=False) |
155 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') | 180 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') |
OLD | NEW |