| OLD | NEW |
| 1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
| 2 | 2 |
| 3 import argparse | 3 import argparse |
| 4 import os | 4 import os |
| 5 import re | 5 import re |
| 6 import subprocess | 6 import subprocess |
| 7 import sys | 7 import sys |
| 8 import tempfile | 8 import tempfile |
| 9 | 9 |
| 10 from utils import shellcmd | 10 from utils import shellcmd |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 ' Default "%(default)s".') | 61 ' Default "%(default)s".') |
| 62 argparser.add_argument('--crosstest-bitcode', required=False, | 62 argparser.add_argument('--crosstest-bitcode', required=False, |
| 63 default=1, type=int, | 63 default=1, type=int, |
| 64 help='Compile non-subzero crosstest object file ' + | 64 help='Compile non-subzero crosstest object file ' + |
| 65 'from the same bitcode as the subzero object. ' + | 65 'from the same bitcode as the subzero object. ' + |
| 66 'If 0, then compile it straight from source.' + | 66 'If 0, then compile it straight from source.' + |
| 67 ' Default %(default)d.') | 67 ' Default %(default)d.') |
| 68 args = argparser.parse_args() | 68 args = argparser.parse_args() |
| 69 | 69 |
| 70 nacl_root = FindBaseNaCl() | 70 nacl_root = FindBaseNaCl() |
| 71 # Prepend host_x86_32/bin to $PATH. | 71 # Prepend PNaCl bin to $PATH. |
| 72 os.environ['PATH'] = nacl_root + \ | 72 os.environ['PATH'] = nacl_root + \ |
| 73 '/toolchain/linux_x86/pnacl_newlib/host_x86_32/bin' + \ | 73 '/toolchain/linux_x86/pnacl_newlib/bin' + \ |
| 74 os.pathsep + os.environ['PATH'] | 74 os.pathsep + os.environ['PATH'] |
| 75 | 75 |
| 76 objs = [] | 76 objs = [] |
| 77 remove_internal = re.compile('^define internal ') | 77 remove_internal = re.compile('^define internal ') |
| 78 fix_target = re.compile('le32-unknown-nacl') | 78 fix_target = re.compile('le32-unknown-nacl') |
| 79 for arg in args.test: | 79 for arg in args.test: |
| 80 base, ext = os.path.splitext(arg) | 80 base, ext = os.path.splitext(arg) |
| 81 if ext == '.ll': | 81 if ext == '.ll': |
| 82 bitcode = arg | 82 bitcode = arg |
| 83 else: | 83 else: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 objs.append(bitcode) | 140 objs.append(bitcode) |
| 141 | 141 |
| 142 # Use 'clang szrt.c' -or- 'clang++ szrt.cpp' | 142 # Use 'clang szrt.c' -or- 'clang++ szrt.cpp' |
| 143 objs.append(( | 143 objs.append(( |
| 144 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' | 144 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' |
| 145 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) | 145 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) |
| 146 linker = 'clang' if pure_c else 'clang++' | 146 linker = 'clang' if pure_c else 'clang++' |
| 147 shellcmd([linker, '-g', '-m32', args.driver] + | 147 shellcmd([linker, '-g', '-m32', args.driver] + |
| 148 objs + | 148 objs + |
| 149 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) | 149 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) |
| OLD | NEW |