| OLD | NEW |
| 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 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 'arm32': ['-triple=%s' % ( | 18 'arm32': ['-triple=%s' % ( |
| 19 'armv7a-nacl' if sandboxed else 'armv7a'), | 19 'armv7a-nacl' if sandboxed else 'armv7a'), |
| 20 '-mcpu=cortex-a9', '-mattr=+neon'], | 20 '-mcpu=cortex-a9', '-mattr=+neon'], |
| 21 'mips32': ['-triple=mipsel' ] } | 21 'mips32': ['-triple=mipsel' ] } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 'convert to Subzero') | 53 'convert to Subzero') |
| 54 argparser.add_argument('--llvm-source', required=False, | 54 argparser.add_argument('--llvm-source', required=False, |
| 55 action='store_true', | 55 action='store_true', |
| 56 help='Parse source directly into llvm IR ' + | 56 help='Parse source directly into llvm IR ' + |
| 57 '(without generating a pexe), then ' + | 57 '(without generating a pexe), then ' + |
| 58 'convert to Subzero') | 58 'convert to Subzero') |
| 59 argparser.add_argument( | 59 argparser.add_argument( |
| 60 '--pnacl-sz', required=False, default='./pnacl-sz', metavar='PNACL-SZ', | 60 '--pnacl-sz', required=False, default='./pnacl-sz', metavar='PNACL-SZ', |
| 61 help="Subzero translator 'pnacl-sz'") | 61 help="Subzero translator 'pnacl-sz'") |
| 62 argparser.add_argument('--pnacl-bin-path', required=False, | 62 argparser.add_argument('--pnacl-bin-path', required=False, |
| 63 default=None, metavar='PNACL_BIN_PATH', | 63 default=( |
| 64 '{root}/toolchain/linux_x86/pnacl_newlib_raw/bin' |
| 65 ).format(root=FindBaseNaCl()), |
| 66 metavar='PNACL_BIN_PATH', |
| 64 help='Path to LLVM & Binutils executables ' + | 67 help='Path to LLVM & Binutils executables ' + |
| 65 '(e.g. for building PEXE files)') | 68 '(e.g. for building PEXE files)') |
| 66 argparser.add_argument('--assemble', required=False, | 69 argparser.add_argument('--assemble', required=False, |
| 67 action='store_true', | 70 action='store_true', |
| 68 help='Assemble the output') | 71 help='Assemble the output') |
| 69 argparser.add_argument('--disassemble', required=False, | 72 argparser.add_argument('--disassemble', required=False, |
| 70 action='store_true', | 73 action='store_true', |
| 71 help='Disassemble the assembled output') | 74 help='Disassemble the assembled output') |
| 72 argparser.add_argument('--dis-flags', required=False, | 75 argparser.add_argument('--dis-flags', required=False, |
| 73 action='append', default=[], | 76 action='append', default=[], |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 [asm_temp.name]) | 165 [asm_temp.name]) |
| 163 | 166 |
| 164 stdout_result = shellcmd(cmd, echo=args.echo_cmd) | 167 stdout_result = shellcmd(cmd, echo=args.echo_cmd) |
| 165 if not args.echo_cmd: | 168 if not args.echo_cmd: |
| 166 sys.stdout.write(stdout_result) | 169 sys.stdout.write(stdout_result) |
| 167 if asm_temp: | 170 if asm_temp: |
| 168 os.remove(asm_temp.name) | 171 os.remove(asm_temp.name) |
| 169 | 172 |
| 170 if __name__ == '__main__': | 173 if __name__ == '__main__': |
| 171 main() | 174 main() |
| OLD | NEW |