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 | 6 |
7 Import('env') | 7 Import('env') |
8 | 8 |
9 # TODO(mseaborn): Enable -Wstrict-prototypes here. Currently | 9 # TODO(mseaborn): Enable -Wstrict-prototypes here. Currently |
10 # dlmalloc/malloc.c does not build with this warning. | 10 # dlmalloc/malloc.c does not build with this warning. |
11 env.FilterOut(CFLAGS=['-Wstrict-prototypes']) | 11 env.FilterOut(CFLAGS=['-Wstrict-prototypes']) |
12 | 12 |
13 # This module shouldn't be built in an environment that uses glibc. | 13 # This module shouldn't be built in an environment that uses glibc. |
14 if env.Bit('nacl_glibc'): | 14 if env.Bit('nacl_glibc'): |
15 raise UserError('src/untrusted/irt/nacl.scons in the wrong environment?') | 15 raise UserError('src/untrusted/irt/nacl.scons in the wrong environment?') |
16 | 16 |
17 blob_env = env.Clone() | 17 blob_env = env.Clone() |
18 blob_env.Append(LINKFLAGS=[blob_env.RodataSwitch('${IRT_BLOB_DATA_START}'), | 18 blob_env.Append(LINKFLAGS=[blob_env.RodataSwitch('${IRT_BLOB_DATA_START}'), |
19 blob_env.TextSwitch('${IRT_BLOB_CODE_START}')]) | 19 blob_env.TextSwitch('${IRT_BLOB_CODE_START}')]) |
20 | 20 |
21 irt_support_sources = [ | 21 irt_support_sources = [ |
| 22 'irt_entry.c', |
22 'irt_malloc.c', | 23 'irt_malloc.c', |
23 'irt_private_pthread.c', | 24 'irt_private_pthread.c', |
24 'irt_private_tls.c', | 25 'irt_private_tls.c', |
25 ] | 26 ] |
26 | 27 |
27 irt_entry_obj = blob_env.ComponentObject('irt_entry.c') | |
28 | |
29 # NACL_GC_WRAP_SYSCALL uses ({...}) syntax. | 28 # NACL_GC_WRAP_SYSCALL uses ({...}) syntax. |
30 blob_env.FilterOut(CCFLAGS=['-pedantic']) | 29 blob_env.FilterOut(CCFLAGS=['-pedantic']) |
31 | 30 |
32 irt_common_interfaces = [ | 31 irt_common_interfaces = [ |
33 'irt_basic.c', | 32 'irt_basic.c', |
34 'irt_fdio.c', | 33 'irt_fdio.c', |
35 'irt_filename.c', | 34 'irt_filename.c', |
36 'irt_memory.c', | 35 'irt_memory.c', |
37 'irt_dyncode.c', | 36 'irt_dyncode.c', |
38 'irt_thread.c', | 37 'irt_thread.c', |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 # Publish the object file for tests/irt_private_pthread to use. | 75 # Publish the object file for tests/irt_private_pthread to use. |
77 # Putting aeabi_read_tp.o into libirt_support_private is not | 76 # Putting aeabi_read_tp.o into libirt_support_private is not |
78 # sufficient because of link ordering issues. | 77 # sufficient because of link ordering issues. |
79 env.Replicate('${STAGING_DIR}', read_tp_obj) | 78 env.Replicate('${STAGING_DIR}', read_tp_obj) |
80 | 79 |
81 # Build a library so that irt_support_objs can be used in tests that | 80 # Build a library so that irt_support_objs can be used in tests that |
82 # cover IRT-internal code. | 81 # cover IRT-internal code. |
83 env.ComponentLibrary('libirt_support_private', irt_support_objs) | 82 env.ComponentLibrary('libirt_support_private', irt_support_objs) |
84 | 83 |
85 irt_nonbrowser = ['irt_interfaces.c', | 84 irt_nonbrowser = ['irt_interfaces.c', |
86 'irt_core_entry.c', | |
87 'irt_core_resource.c', | 85 'irt_core_resource.c', |
88 ] | 86 ] |
89 | 87 |
90 irt_libs = ['srpc', | 88 irt_libs = ['srpc', |
91 'imc_syscalls', | 89 'imc_syscalls', |
92 'platform', | 90 'platform', |
93 'gio', | 91 'gio', |
94 'm', | 92 'm', |
95 ] | 93 ] |
96 | 94 |
97 irt_core_library = blob_env.ComponentProgram( | 95 irt_core_library = blob_env.ComponentProgram( |
98 'irt_core', | 96 'irt_core', irt_support_objs + irt_nonbrowser, EXTRA_LIBS=irt_libs) |
99 [irt_entry_obj] + irt_support_objs + irt_nonbrowser, | |
100 EXTRA_LIBS=irt_libs) | |
101 env.SDKInstallBin('irt_core.nexe', irt_core_library) | 97 env.SDKInstallBin('irt_core.nexe', irt_core_library) |
102 | 98 |
103 # TODO(mcgrathr): these should be installed, but scons is a mystery | 99 # TODO(mcgrathr): these should be installed, but scons is a mystery |
104 #env.AddHeaderToSdk(['irt.h']) | 100 #env.AddHeaderToSdk(['irt.h']) |
105 #env.AddHeaderToSdk(['irt_ppapi.h']) | 101 #env.AddHeaderToSdk(['irt_ppapi.h']) |
106 | 102 |
107 # Make sure that the linked IRT nexe never uses TLS via the TLS ABI | 103 # Make sure that the linked IRT nexe never uses TLS via the TLS ABI |
108 # register (e.g., %gs on x86-32). All IRT code must avoid direct use | 104 # register (e.g., %gs on x86-32). All IRT code must avoid direct use |
109 # of the TLS ABI register, which is reserved for user TLS. Instead, | 105 # of the TLS ABI register, which is reserved for user TLS. Instead, |
110 # ensure all TLS accesses use a call to __nacl_read_tp (or __aeabi_read_tp | 106 # ensure all TLS accesses use a call to __nacl_read_tp (or __aeabi_read_tp |
111 # for ARM), which the IRT code overrides to segregate IRT-private TLS | 107 # for ARM), which the IRT code overrides to segregate IRT-private TLS |
112 # from user TLS. | 108 # from user TLS. |
113 if ((env.Bit('build_arm') or env.Bit('build_x86_32')) | 109 if ((env.Bit('build_arm') or env.Bit('build_x86_32')) |
114 # Do not try to run OBJDUMP if 'built_elsewhere', since that *might* | 110 # Do not try to run OBJDUMP if 'built_elsewhere', since that *might* |
115 # mean that a toolchain is not even present. E.g., the arm buildbots | 111 # mean that a toolchain is not even present. E.g., the arm buildbots |
116 # do not have the pnacl toolchain, since that is built for x86 hosts. | 112 # do not have the pnacl toolchain, since that is built for x86 hosts. |
117 and not env.Bit('built_elsewhere')): | 113 and not env.Bit('built_elsewhere')): |
118 check_tls_arch = '${TARGET_FULLARCH}' | 114 check_tls_arch = '${TARGET_FULLARCH}' |
119 if env.Bit('build_arm'): | 115 if env.Bit('build_arm'): |
120 check_tls_arch = 'arm' | 116 check_tls_arch = 'arm' |
121 node = env.CommandTest('irt_core_tls_test.out', | 117 node = env.CommandTest('irt_core_tls_test.out', |
122 ['${PYTHON}', env.File('check_tls.py'), | 118 ['${PYTHON}', env.File('check_tls.py'), |
123 check_tls_arch, '${OBJDUMP}', irt_core_library], | 119 check_tls_arch, '${OBJDUMP}', irt_core_library], |
124 # don't run ${PYTHON} under the emulator. | 120 # don't run ${PYTHON} under the emulator. |
125 direct_emulation=False) | 121 direct_emulation=False) |
126 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') | 122 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') |
OLD | NEW |