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

Side by Side Diff: src/trusted/validator/x86/decoder/build.scons

Issue 636933004: stop building/testing old x86 validator. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: rebase master Created 6 years, 2 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
(Empty)
1 # -*- python -*-
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6
7 import os
8 import sys
9 Import('env')
10
11 #
12 #
13 # Build x86 only pieces
14 #
15 #
16 if not env.Bit('target_x86'): Return()
17
18 # TODO(bradchen): eliminate need for the following line
19 env.FilterOut(CCFLAGS=['-Wextra', '-Wswitch-enum', '-Wsign-compare'])
20
21 #----------- FILE GENERATION --------------------------
22 #
23 # Generates source files needed by the decoder.
24
25 generate = False
26 if 'valgen' in COMMAND_LINE_TARGETS: generate = True
27 if 'valclean' in COMMAND_LINE_TARGETS: generate = True
28
29 #
30 # Only generate/clean these files if the alias is specified on the
31 # command line. We conditionally add these pieces to scons to prevent
32 # a normal invocation from accidentally regenerating the files.
33 #
34 if generate:
35 #
36 # valgen - Table Generator
37 #
38 # We create an alias 'valgen' which we use to generate the various
39 # headers used by the x86 validator. This target will generate
40 # *.h, *_impl.h from the *.enum files.
41 #
42
43 # Define environment for generating files.
44 gen_env = env.Clone()
45 gen_env.Append(CCFLAGS=['-DNACL_TRUSTED_BUT_NOT_TCB'])
46
47 # Get the directory in which we will generate checking in files.
48 header_prefix = env.subst('${MAIN_DIR}')
49 if header_prefix.endswith('/native_client'):
50 header_prefix = header_prefix[0:header_prefix.rfind('native_client')]
51 elif header_prefix.endswith('/native_client/'):
52 header_prefix = header_prefix[0:header_prefix.rfind('native_client/')]
53 decoder_src_dir = '$MAIN_DIR/src/trusted/validator/x86/decoder'
54
55 #------------------------------------------------------
56 # Generate the needed header files for enumerated types.
57 # Note that we use the same directory for all platforms.
58
59 # Define enumerate type files, and the options to process.
60 enum_headers = []
61 ncv_enum_pairs = {
62 'ncopcode_prefix': '--name=NaClInstPrefix --add_size=1',
63 'ncopcode_insts':
64 '--name=NaClMnemonic --add_size=1 --sort=1 --name_prefix=Inst',
65 'ncopcode_opcode_flags': '--name=NaClIFlag --add_size=1',
66 'ncopcode_operand_kind': '--name=NaClOpKind --add_size=1',
67 'ncopcode_operand_flag': '--name=NaClOpFlag --add_size=1',
68 'ncop_expr_node_flag': '--name=NaClExpFlag --add_size=1',
69 'ncop_expr_node_kind': '--name=NaClExpKind --add_size=1',
70 }
71
72 # Now code generate the enumerated types.
73 for ncv_enum in ncv_enum_pairs:
74 ncv_options = ncv_enum_pairs[ncv_enum]
75 ncv_enum_file = gen_env.File(ncv_enum + '.enum')
76 ncv_header_1 = gen_env.File('%s/gen/%s.h' % (decoder_src_dir, ncv_enum))
77 ncv_header_2 = gen_env.File('%s/gen/%s_impl.h' % (decoder_src_dir, ncv_enum) )
78
79 cmd_line = (
80 '${PYTHON} %s --header="%s" --source="%s" --path_prefix="%s" %s %s' %
81 (gen_env.File('%s/../../../validator_x86/enum_gen.py' % decoder_src_dir) ,
82 ncv_header_1, ncv_header_2, header_prefix,
83 ncv_options, ncv_enum_file))
84 gen_env.Command([ncv_header_1, ncv_header_2], ncv_enum_file, cmd_line)
85 enum_headers.append(ncv_header_1)
86 enum_headers.append(ncv_header_2)
87
88 gen_list = enum_headers
89 gen_env.AlwaysBuild(
90 gen_env.Alias('valgen', gen_list))
91 gen_env.AlwaysBuild(
92 gen_env.Alias('valclean', action=[Delete(x) for x in gen_list]))
93
94 #---------- TESTS --------------------------------------
95 #
96 # Create environment for command-line tools and testing, rather than
97 # part of the TCB. Then define compile-time flag that communicates
98 # that we are compiling in the test environment (rather than for the TCB).
99 test_env = env.Clone()
100 test_env.Append(CCFLAGS=['-DNACL_TRUSTED_BUT_NOT_TCB'])
101
102 #---------- COMPONENTS BUILT ---------------------------
103
104 # TODO(karl): merge nc_opcode_modeling and nc_decoder libraries.
105 # Instruction modeling for the decoder.
106 env.ComponentLibrary(env.NaClTargetArchSuffix('nc_opcode_modeling'),
107 ['ncopcode_desc.c',
108 ])
109
110 # Verbose routines for instruction modeling for the decoder.
111 env.ComponentLibrary(env.NaClTargetArchSuffix('nc_opcode_modeling_verbose'),
112 ['ncopcode_desc_verbose.c',
113 ])
114
115 # Decoder library.
116 env.ComponentLibrary(env.NaClTargetArchSuffix('nc_decoder'),
117 ['nc_inst_iter.c',
118 'nc_inst_state.c',
119 'nc_inst_trans.c',
120 'ncop_exps.c',
121 ])
122
123 # Full decoder tables.
124 env.ComponentLibrary(env.NaClTargetArchSuffix('ncdis_decode_tables'),
125 ['ncdis_decode_tables.c'])
126
127 #---------- UNIT TESTS ---------------------------------
128
129 # Create an environment to run unit tests using Gtest.
130 gtest_env = env.MakeGTestEnv()
131
132 # List of (unit) test file prefixes to run unit tests on.
133 gtest_sources = ['nc_inst_state']
134
135 for source in gtest_sources:
136 test_exe = gtest_env.ComponentProgram(
137 'x86_decoder_tests_' + source,
138 [source+'_tests.cc'],
139 EXTRA_LIBS=[# Note: The following forces the inclusion
140 # of kNaClDecoderTables
141 gtest_env.NaClTargetArchSuffix('ncval_seg_sfi'),
142 gtest_env.NaClTargetArchSuffix('nc_decoder'),
143 gtest_env.NaClTargetArchSuffix('ncdis_decode_tables'),
144 gtest_env.NaClTargetArchSuffix('nc_opcode_modeling_verbose'),
145 ])
146 test_node = gtest_env.CommandTest(
147 source+'Tests.out',
148 command=[test_exe])
149 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'],
150 'run_x86_validator_tests')
OLDNEW
« no previous file with comments | « src/trusted/validator/x86/build.scons ('k') | src/trusted/validator/x86/decoder/generator/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698