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

Side by Side Diff: pydir/run-pnacl-sz.py

Issue 1499973002: Revert "Subzero. ARM32. Initial sandboxing code." (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pydir/crosstest_generator.py ('k') | pydir/szbuild.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import itertools 4 import itertools
5 import os 5 import os
6 import re 6 import re
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 10
11 from utils import shellcmd 11 from utils import shellcmd
12 12
13 13
14 def TargetAssemblerFlags(target, sandboxed): 14 def TargetAssemblerFlags(target):
15 # TODO(stichnot): -triple=i686-nacl should be used for a 15 # TODO(stichnot): -triple=i686-nacl should be used for a
16 # sandboxing test. This means there should be an args.sandbox 16 # sandboxing test. This means there should be an args.sandbox
17 # argument that also gets passed through to pnacl-sz. 17 # argument that also gets passed through to pnacl-sz.
18 # TODO(reed kotler). Need to find out exactly we need to 18 # TODO(reed kotler). Need to find out exactly we need to
19 # add here for Mips32. 19 # add here for Mips32.
20 flags = { 'x8632': ['-triple=%s' % ('i686' if not sandboxed else 'i686-nacl')] , 20 flags = { 'x8632': ['-triple=i686'],
21 'arm32': ['-triple=%s' % ( 21 'arm32': ['-triple=armv7a', '-mcpu=cortex-a9', '-mattr=+neon'],
22 'armv7a' if not sandboxed else 'armv7a-nacl'),
23 '-mcpu=cortex-a9', '-mattr=+neon'],
24 'mips32': ['-triple=mipsel' ] } 22 'mips32': ['-triple=mipsel' ] }
25 return flags[target] 23 return flags[target]
26 24
27 25
28 def TargetDisassemblerFlags(target): 26 def TargetDisassemblerFlags(target):
29 flags = { 'x8632': ['-Mintel'], 27 flags = { 'x8632': ['-Mintel'],
30 'arm32': [], 28 'arm32': [],
31 'mips32':[] } 29 'mips32':[] }
32 return flags[target] 30 return flags[target]
33 31
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 argparser.add_argument('--echo-cmd', required=False, 82 argparser.add_argument('--echo-cmd', required=False,
85 action='store_true', 83 action='store_true',
86 help='Trace command that generates ICE instructions') 84 help='Trace command that generates ICE instructions')
87 argparser.add_argument('--tbc', required=False, action='store_true', 85 argparser.add_argument('--tbc', required=False, action='store_true',
88 help='Input is textual bitcode (not .ll)') 86 help='Input is textual bitcode (not .ll)')
89 argparser.add_argument('--expect-fail', required=False, action='store_true', 87 argparser.add_argument('--expect-fail', required=False, action='store_true',
90 help='Negate success of run by using LLVM not') 88 help='Negate success of run by using LLVM not')
91 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, 89 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER,
92 default=[], 90 default=[],
93 help='Remaining arguments are passed to pnacl-sz') 91 help='Remaining arguments are passed to pnacl-sz')
94 argparser.add_argument('--sandbox', required=False, action='store_true',
95 help='Sanboxes the generated code.')
96 92
97 args = argparser.parse_args() 93 args = argparser.parse_args()
98 pnacl_bin_path = args.pnacl_bin_path 94 pnacl_bin_path = args.pnacl_bin_path
99 llfile = args.input 95 llfile = args.input
100 96
101 if args.llvm and args.llvm_source: 97 if args.llvm and args.llvm_source:
102 raise RuntimeError("Can't specify both '--llvm' and '--llvm-source'") 98 raise RuntimeError("Can't specify both '--llvm' and '--llvm-source'")
103 99
104 if args.llvm_source and args.no_local_syms: 100 if args.llvm_source and args.no_local_syms:
105 raise RuntimeError("Can't specify both '--llvm-source' and " + 101 raise RuntimeError("Can't specify both '--llvm-source' and " +
(...skipping 12 matching lines...) Expand all
118 elif not args.llvm_source: 114 elif not args.llvm_source:
119 cmd = [os.path.join(pnacl_bin_path, 'llvm-as'), llfile, '-o', '-', '|', 115 cmd = [os.path.join(pnacl_bin_path, 'llvm-as'), llfile, '-o', '-', '|',
120 os.path.join(pnacl_bin_path, 'pnacl-freeze')] 116 os.path.join(pnacl_bin_path, 'pnacl-freeze')]
121 if not args.no_local_syms: 117 if not args.no_local_syms:
122 cmd += ['--allow-local-symbol-tables'] 118 cmd += ['--allow-local-symbol-tables']
123 cmd += ['|'] 119 cmd += ['|']
124 if args.expect_fail: 120 if args.expect_fail:
125 cmd += [os.path.join(pnacl_bin_path, 'not')] 121 cmd += [os.path.join(pnacl_bin_path, 'not')]
126 cmd += [args.pnacl_sz] 122 cmd += [args.pnacl_sz]
127 cmd += ['--target', args.target] 123 cmd += ['--target', args.target]
128 if args.sandbox:
129 cmd += ['-sandbox']
130 if args.insts: 124 if args.insts:
131 # If the tests are based on '-verbose inst' output, force 125 # If the tests are based on '-verbose inst' output, force
132 # single-threaded translation because dump output does not get 126 # single-threaded translation because dump output does not get
133 # reassembled into order. 127 # reassembled into order.
134 cmd += ['-verbose', 'inst', '-notranslate', '-threads=0'] 128 cmd += ['-verbose', 'inst', '-notranslate', '-threads=0']
135 if not args.llvm_source: 129 if not args.llvm_source:
136 cmd += ['--bitcode-format=pnacl'] 130 cmd += ['--bitcode-format=pnacl']
137 if not args.no_local_syms: 131 if not args.no_local_syms:
138 cmd += ['--allow-local-symbol-tables'] 132 cmd += ['--allow-local-symbol-tables']
139 if args.llvm or args.llvm_source: 133 if args.llvm or args.llvm_source:
140 cmd += ['--build-on-read=0'] 134 cmd += ['--build-on-read=0']
141 else: 135 else:
142 cmd += ['--build-on-read=1'] 136 cmd += ['--build-on-read=1']
143 cmd += ['--filetype=' + args.filetype] 137 cmd += ['--filetype=' + args.filetype]
144 cmd += args.args 138 cmd += args.args
145 if args.llvm_source: 139 if args.llvm_source:
146 cmd += [llfile] 140 cmd += [llfile]
147 asm_temp = None 141 asm_temp = None
148 if args.assemble or args.disassemble: 142 if args.assemble or args.disassemble:
149 # On windows we may need to close the file first before it can be 143 # On windows we may need to close the file first before it can be
150 # re-opened by the other tools, so don't do delete-on-close, 144 # re-opened by the other tools, so don't do delete-on-close,
151 # and instead manually delete. 145 # and instead manually delete.
152 asm_temp = tempfile.NamedTemporaryFile(delete=False) 146 asm_temp = tempfile.NamedTemporaryFile(delete=False)
153 asm_temp.close() 147 asm_temp.close()
154 if args.assemble and args.filetype != 'obj': 148 if args.assemble and args.filetype != 'obj':
155 cmd += (['|', os.path.join(pnacl_bin_path, 'llvm-mc')] + 149 cmd += (['|', os.path.join(pnacl_bin_path, 'llvm-mc')] +
156 TargetAssemblerFlags(args.target, args.sandbox) + 150 TargetAssemblerFlags(args.target) +
157 ['-filetype=obj', '-o', asm_temp.name]) 151 ['-filetype=obj', '-o', asm_temp.name])
158 elif asm_temp: 152 elif asm_temp:
159 cmd += ['-o', asm_temp.name] 153 cmd += ['-o', asm_temp.name]
160 if args.disassemble: 154 if args.disassemble:
161 # Show wide instruction encodings, diassemble, and show relocs. 155 # Show wide instruction encodings, diassemble, and show relocs.
162 cmd += (['&&', os.path.join(pnacl_bin_path, 'le32-nacl-objdump')] + 156 cmd += (['&&', os.path.join(pnacl_bin_path, 'le32-nacl-objdump')] +
163 args.dis_flags + 157 args.dis_flags +
164 ['-w', '-d', '-r'] + TargetDisassemblerFlags(args.target) + 158 ['-w', '-d', '-r'] + TargetDisassemblerFlags(args.target) +
165 [asm_temp.name]) 159 [asm_temp.name])
166 160
167 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 161 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
168 if not args.echo_cmd: 162 if not args.echo_cmd:
169 sys.stdout.write(stdout_result) 163 sys.stdout.write(stdout_result)
170 if asm_temp: 164 if asm_temp:
171 os.remove(asm_temp.name) 165 os.remove(asm_temp.name)
172 166
173 if __name__ == '__main__': 167 if __name__ == '__main__':
174 main() 168 main()
OLDNEW
« no previous file with comments | « pydir/crosstest_generator.py ('k') | pydir/szbuild.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698