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

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

Issue 1559243002: Suzero. X8664. NaCl Sandboxing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 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
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 FindBaseNaCl, shellcmd 11 from utils import FindBaseNaCl, shellcmd
12 12
13 13
14 def TargetAssemblerFlags(target, sandboxed): 14 def TargetAssemblerFlags(target, sandboxed):
15 # TODO(reed kotler). Need to find out exactly we need to 15 # TODO(reed kotler). Need to find out exactly we need to
16 # add here for Mips32. 16 # add here for Mips32.
17 flags = { 'x8632': ['-triple=%s' % ('i686-nacl' if sandboxed else 'i686')], 17 flags = { 'x8632': ['-triple=%s' % ('i686-nacl' if sandboxed else 'i686')],
18 'x8664': ['-triple=%s' % (
19 'x86_64-nacl' if sandboxed else 'x86_64')],
18 'arm32': ['-triple=%s' % ( 20 'arm32': ['-triple=%s' % (
19 'armv7a-nacl' if sandboxed else 'armv7a'), 21 'armv7a-nacl' if sandboxed else 'armv7a'),
20 '-mcpu=cortex-a9', '-mattr=+neon'], 22 '-mcpu=cortex-a9', '-mattr=+neon'],
21 'mips32': ['-triple=mipsel' ] } 23 'mips32': ['-triple=mipsel' ] }
22 return flags[target] 24 return flags[target]
23 25
24 26
25 def TargetDisassemblerFlags(target): 27 def TargetDisassemblerFlags(target):
26 flags = { 'x8632': ['-Mintel'], 28 flags = { 'x8632': ['-Mintel'],
29 'x8664': ['-Mintel'],
27 'arm32': [], 30 'arm32': [],
28 'mips32':[] } 31 'mips32':[] }
29 return flags[target] 32 return flags[target]
30 33
31 34
32 def main(): 35 def main():
33 """Run the pnacl-sz compiler on an llvm file. 36 """Run the pnacl-sz compiler on an llvm file.
34 37
35 Takes an llvm input file, freezes it into a pexe file, converts 38 Takes an llvm input file, freezes it into a pexe file, converts
36 it to a Subzero program, and finally compiles it. 39 it to a Subzero program, and finally compiles it.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 argparser.add_argument('--disassemble', required=False, 75 argparser.add_argument('--disassemble', required=False,
73 action='store_true', 76 action='store_true',
74 help='Disassemble the assembled output') 77 help='Disassemble the assembled output')
75 argparser.add_argument('--dis-flags', required=False, 78 argparser.add_argument('--dis-flags', required=False,
76 action='append', default=[], 79 action='append', default=[],
77 help='Add a disassembler flag') 80 help='Add a disassembler flag')
78 argparser.add_argument('--filetype', default='iasm', dest='filetype', 81 argparser.add_argument('--filetype', default='iasm', dest='filetype',
79 choices=['obj', 'asm', 'iasm'], 82 choices=['obj', 'asm', 'iasm'],
80 help='Output file type. Default %(default)s.') 83 help='Output file type. Default %(default)s.')
81 argparser.add_argument('--target', default='x8632', dest='target', 84 argparser.add_argument('--target', default='x8632', dest='target',
82 choices=['x8632','arm32','mips32'], 85 choices=['x8632','x8664','arm32','mips32'],
83 help='Target architecture. Default %(default)s.') 86 help='Target architecture. Default %(default)s.')
84 argparser.add_argument('--echo-cmd', required=False, 87 argparser.add_argument('--echo-cmd', required=False,
85 action='store_true', 88 action='store_true',
86 help='Trace command that generates ICE instructions') 89 help='Trace command that generates ICE instructions')
87 argparser.add_argument('--tbc', required=False, action='store_true', 90 argparser.add_argument('--tbc', required=False, action='store_true',
88 help='Input is textual bitcode (not .ll)') 91 help='Input is textual bitcode (not .ll)')
89 argparser.add_argument('--expect-fail', required=False, action='store_true', 92 argparser.add_argument('--expect-fail', required=False, action='store_true',
90 help='Negate success of run by using LLVM not') 93 help='Negate success of run by using LLVM not')
91 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, 94 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER,
92 default=[], 95 default=[],
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 [asm_temp.name]) 168 [asm_temp.name])
166 169
167 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 170 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
168 if not args.echo_cmd: 171 if not args.echo_cmd:
169 sys.stdout.write(stdout_result) 172 sys.stdout.write(stdout_result)
170 if asm_temp: 173 if asm_temp:
171 os.remove(asm_temp.name) 174 os.remove(asm_temp.name)
172 175
173 if __name__ == '__main__': 176 if __name__ == '__main__':
174 main() 177 main()
OLDNEW
« no previous file with comments | « Makefile.standalone ('k') | pydir/szbuild.py » ('j') | src/IceAssemblerX86BaseImpl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698