Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: src/untrusted/irt/nacl.scons

Issue 140653005: Adds tls_edit utility which patches irt_core.nexe's TLS usage. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: gyp builds with host toolsets should not inherit target flags for arm and mips Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 'nc_condvar']] 62 'nc_condvar']]
63 63
64 irt_support_objs += [ 64 irt_support_objs += [
65 blob_env.ComponentObject('sys_private', 65 blob_env.ComponentObject('sys_private',
66 '${MAIN_DIR}/src/untrusted/nacl/sys_private.c'), 66 '${MAIN_DIR}/src/untrusted/nacl/sys_private.c'),
67 blob_env.ComponentObject( 67 blob_env.ComponentObject(
68 'dynamic_annotations.o', 68 'dynamic_annotations.o',
69 '${MAIN_DIR}/src/untrusted/valgrind/dynamic_annotations.c'), 69 '${MAIN_DIR}/src/untrusted/valgrind/dynamic_annotations.c'),
70 ] 70 ]
71 71
72 if env.Bit('target_arm'):
73 read_tp_obj = blob_env.ComponentObject('aeabi_read_tp.o', 'aeabi_read_tp.S')
74 irt_support_objs.append(read_tp_obj)
75 # Publish the object file for tests/irt_private_pthread to use.
76 # Putting aeabi_read_tp.o into libirt_support_private is not
77 # sufficient because of link ordering issues.
78 env.Replicate('${STAGING_DIR}', read_tp_obj)
79
80 # Build a library so that irt_support_objs can be used in tests that 72 # Build a library so that irt_support_objs can be used in tests that
81 # cover IRT-internal code. 73 # cover IRT-internal code.
82 env.ComponentLibrary('libirt_support_private', irt_support_objs) 74 env.ComponentLibrary('libirt_support_private', irt_support_objs)
83 75
84 irt_nonbrowser = ['irt_interfaces.c', 76 irt_nonbrowser = ['irt_interfaces.c',
85 'irt_core_resource.c', 77 'irt_core_resource.c',
86 ] 78 ]
87 79
88 irt_libs = ['srpc', 80 irt_libs = ['srpc',
89 'imc_syscalls', 81 'imc_syscalls',
90 'platform', 82 'platform',
91 'gio', 83 'gio',
92 'm', 84 'm',
93 ] 85 ]
94 86
95 irt_core_library = blob_env.ComponentProgram( 87 irt_core_raw = blob_env.ComponentProgram(
96 'irt_core', irt_support_objs + irt_nonbrowser, EXTRA_LIBS=irt_libs) 88 'irt_core_raw', irt_support_objs + irt_nonbrowser, EXTRA_LIBS=irt_libs)
89
90 # Compile this program using the host environment instead of the target
91 tls_edit_env = env['BUILD_ENV']
92 tls_edit_exe = tls_edit_env.ComponentProgram(
93 'tls_edit',
94 'tls_edit.c',
95 EXTRA_LIBS=['rdfa_validator', 'platform'])
96
97 tls_edit_library = tls_edit_env.Install('${STAGING_DIR}', tls_edit_exe)
98
99 irt_core_nexe = blob_env.Command(
100 'irt_core.nexe',
101 [tls_edit_library, irt_core_raw],
102 '${SOURCES} ${TARGET}'
103 )
104
105 irt_core_library = blob_env.Install('${STAGING_DIR}', irt_core_nexe)
106 blob_env.Alias('irt_core', irt_core_library)
107 blob_env.ComponentProgramAlias(irt_core_library)
108
97 env.SDKInstallBin('irt_core.nexe', irt_core_library) 109 env.SDKInstallBin('irt_core.nexe', irt_core_library)
98 110
99 # TODO(mcgrathr): these should be installed, but scons is a mystery 111 # TODO(mcgrathr): these should be installed, but scons is a mystery
100 #env.AddHeaderToSdk(['irt.h']) 112 #env.AddHeaderToSdk(['irt.h'])
101 #env.AddHeaderToSdk(['irt_ppapi.h']) 113 #env.AddHeaderToSdk(['irt_ppapi.h'])
102 114
103 # Make sure that the linked IRT nexe never uses TLS via the TLS ABI 115 # Make sure that the linked IRT nexe never uses TLS via the TLS ABI
104 # register (e.g., %gs on x86-32). All IRT code must avoid direct use 116 # register (e.g., %gs on x86-32). All IRT code must avoid direct use
105 # of the TLS ABI register, which is reserved for user TLS. Instead, 117 # of the TLS ABI register, which is reserved for user TLS. Instead,
106 # ensure all TLS accesses use a call to __nacl_read_tp (or __aeabi_read_tp 118 # ensure all TLS accesses use a call to __nacl_read_tp (or __aeabi_read_tp
107 # for ARM), which the IRT code overrides to segregate IRT-private TLS 119 # for ARM), which the IRT code overrides to segregate IRT-private TLS
108 # from user TLS. 120 # from user TLS.
109 if ((env.Bit('build_arm') or env.Bit('build_x86_32')) 121 if ((env.Bit('build_arm') or env.Bit('build_x86_32'))
110 # Do not try to run OBJDUMP if 'built_elsewhere', since that *might* 122 # Do not try to run OBJDUMP if 'built_elsewhere', since that *might*
111 # mean that a toolchain is not even present. E.g., the arm buildbots 123 # mean that a toolchain is not even present. E.g., the arm buildbots
112 # do not have the pnacl toolchain, since that is built for x86 hosts. 124 # do not have the pnacl toolchain, since that is built for x86 hosts.
113 and not env.Bit('built_elsewhere')): 125 and not env.Bit('built_elsewhere')):
114 check_tls_arch = '${TARGET_FULLARCH}' 126 check_tls_arch = '${TARGET_FULLARCH}'
115 if env.Bit('build_arm'): 127 if env.Bit('build_arm'):
116 check_tls_arch = 'arm' 128 check_tls_arch = 'arm'
117 node = env.CommandTest('irt_core_tls_test.out', 129 node = env.CommandTest('irt_core_tls_test.out',
118 ['${PYTHON}', env.File('check_tls.py'), 130 ['${PYTHON}', env.File('check_tls.py'),
119 check_tls_arch, '${OBJDUMP}', irt_core_library], 131 check_tls_arch, '${OBJDUMP}', irt_core_library],
120 # don't run ${PYTHON} under the emulator. 132 # don't run ${PYTHON} under the emulator.
121 direct_emulation=False) 133 direct_emulation=False)
122 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test') 134 env.AddNodeToTestSuite(node, ['small_tests'], 'run_irt_core_tls_test')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698