| 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']) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 irt_browser = ['irt_interfaces_ppapi.c', | 117 irt_browser = ['irt_interfaces_ppapi.c', |
| 94 'irt_entry_ppapi.c', | 118 'irt_entry_ppapi.c', |
| 95 'irt_ppapi.c', | 119 'irt_ppapi.c', |
| 96 'irt_manifest.c', | 120 'irt_manifest.c', |
| 97 'irt_nameservice.c', | 121 'irt_nameservice.c', |
| 98 'irt_random.c', | 122 'irt_random.c', |
| 99 ] | 123 ] |
| 100 | 124 |
| 101 def LinkIrt(output, files, libs): | 125 def LinkIrt(output, files, libs): |
| 102 return blob_env.ComponentProgram(output, | 126 return blob_env.ComponentProgram(output, |
| 103 [irt_entry_obj] + irt_support_objs + files, | 127 [irt_entry_obj, irt_shim_obj] + |
| 128 irt_support_objs + files, |
| 104 EXTRA_LIBS=libs) | 129 EXTRA_LIBS=libs) |
| 105 | 130 |
| 106 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) | 131 irt_core_library = LinkIrt('irt_core', irt_nonbrowser, []) |
| 107 irt_library = LinkIrt('irt', irt_browser, ['ppruntime', | 132 irt_library = LinkIrt('irt', irt_browser, ['ppruntime', |
| 108 'srpc', | 133 'srpc', |
| 109 'imc_syscalls', | 134 'imc_syscalls', |
| 110 'platform', | 135 'platform', |
| 111 'gio', | 136 'gio', |
| 112 'm']) | 137 'm']) |
| 113 | 138 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 143 # Holy cow it takes over 30 seconds to disassemble | 168 # Holy cow it takes over 30 seconds to disassemble |
| 144 # the ARM irt.nexe. Set test size to 'large'. | 169 # the ARM irt.nexe. Set test size to 'large'. |
| 145 size='large') | 170 size='large') |
| 146 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') | 171 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_tls_test') |
| 147 node = env.CommandTest('irt_core_tls_test.out', | 172 node = env.CommandTest('irt_core_tls_test.out', |
| 148 ['${PYTHON}', env.File('check_tls.py'), | 173 ['${PYTHON}', env.File('check_tls.py'), |
| 149 check_tls_arch, '${OBJDUMP}', irt_core_library], | 174 check_tls_arch, '${OBJDUMP}', irt_core_library], |
| 150 # don't run ${PYTHON} under the emulator. | 175 # don't run ${PYTHON} under the emulator. |
| 151 direct_emulation=False) | 176 direct_emulation=False) |
| 152 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') | 177 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') |
| OLD | NEW |