OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 Import('env') | |
6 | |
7 trusted_env = env['TRUSTED_ENV'] | |
jvoung (off chromium)
2014/09/05 00:32:00
You might have to test that trusted_env is not som
dbrazdil
2014/09/05 19:41:38
Done.
| |
8 if not env.Bit('bitcode') or not env.Bit('minsfi') or \ | |
9 not trusted_env.Bit('build_x86') or trusted_env.Bit('windows'): | |
10 Return() | |
11 | |
12 def CompileSandbox(name, ptrsize=0): | |
13 bc_env = env.Clone() | |
14 bc_env.Replace(CCFLAGS=[], LINKFLAGS=[]) | |
15 bc_env.Append(EXTRA_LIBS=['${NONIRT_LIBS}']) | |
16 | |
17 name_trusted = '%s_trusted' % name | |
18 name_untrusted = '%s_untrusted' % name | |
19 srcs_trusted = [ '%s.c' % name_trusted ] | |
20 srcs_untrusted = [ '%s.c' % name_untrusted ] | |
21 | |
22 if ptrsize == 0: | |
23 ptrsize = 24 if trusted_env.Bit('build_x86_32') else 32 | |
24 | |
25 bitcode_file = bc_env.ComponentObject(name_untrusted, srcs_untrusted) | |
26 | |
27 opt_ptrsize = '-minsfi-ptrsize=%d ' % ptrsize | |
28 opt_result = env.Command( | |
29 name + '.minsfi.bc', [bitcode_file], | |
30 '${PNACLOPT} ' | |
31 '-minsfi-strip-tls ' | |
32 '-pnacl-abi-simplify-preopt ' | |
33 '-pnacl-abi-simplify-postopt ' | |
34 '-minsfi ' | |
35 + opt_ptrsize + | |
36 '${SOURCES} -o ${TARGET}') | |
37 | |
38 llc_result = env.Command( | |
39 name + '.minsfi.o', [opt_result], | |
40 '${LLC} ' | |
41 '${SOURCES} -o ${TARGET}') | |
42 | |
43 main = trusted_env.ComponentObject(name_trusted, srcs_trusted) | |
44 prog = trusted_env.ComponentProgram(name , [llc_result, main], | |
45 EXTRA_LIBS=['minsfi_runtime']) | |
46 | |
47 node = env.CommandTest('%s.out' % name, [prog]) | |
48 env.AddNodeToTestSuite(node, | |
49 ['small_tests', 'toolchain_tests', 'nonpexe_tests'], | |
50 'run_minsfi_' + name + '_test') | |
51 | |
52 CompileSandbox('init') | |
OLD | NEW |