| 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 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 cmd += ['-allow-pnacl-reader-error-recovery', '-threads=0'] | 157 cmd += ['-allow-pnacl-reader-error-recovery', '-threads=0'] |
| 158 if not args.llvm_source: | 158 if not args.llvm_source: |
| 159 cmd += ['--bitcode-format=pnacl'] | 159 cmd += ['--bitcode-format=pnacl'] |
| 160 if not args.no_local_syms: | 160 if not args.no_local_syms: |
| 161 cmd += ['--allow-local-symbol-tables'] | 161 cmd += ['--allow-local-symbol-tables'] |
| 162 if args.llvm or args.llvm_source: | 162 if args.llvm or args.llvm_source: |
| 163 cmd += ['--build-on-read=0'] | 163 cmd += ['--build-on-read=0'] |
| 164 else: | 164 else: |
| 165 cmd += ['--build-on-read=1'] | 165 cmd += ['--build-on-read=1'] |
| 166 cmd += ['--filetype=' + args.filetype] | 166 cmd += ['--filetype=' + args.filetype] |
| 167 cmd += ['--emit-revision=0'] |
| 167 script_name = os.path.basename(sys.argv[0]) | 168 script_name = os.path.basename(sys.argv[0]) |
| 168 for _, arg in enumerate(args.args): | 169 for _, arg in enumerate(args.args): |
| 169 # Redirecting the output file needs to be done through the script | 170 # Redirecting the output file needs to be done through the script |
| 170 # because forceasm may introduce a new temporary file between pnacl-sz | 171 # because forceasm may introduce a new temporary file between pnacl-sz |
| 171 # and llvm-mc. Similar issues could occur when setting filetype, target, | 172 # and llvm-mc. Similar issues could occur when setting filetype, target, |
| 172 # or sandbox through --args. Filter and report an error. | 173 # or sandbox through --args. Filter and report an error. |
| 173 if re.search('^-?-(o|output|filetype|target|sandbox)(=.+)?$', arg): | 174 if re.search('^-?-(o|output|filetype|target|sandbox)(=.+)?$', arg): |
| 174 preferred_option = '--output' if re.search('^-?-o(=.+)?$', arg) else arg | 175 preferred_option = '--output' if re.search('^-?-o(=.+)?$', arg) else arg |
| 175 print 'Option should be set using:' | 176 print 'Option should be set using:' |
| 176 print ' %s ... %s ... --args' % (script_name, preferred_option) | 177 print ' %s ... %s ... --args' % (script_name, preferred_option) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 [output_file_name]) | 209 [output_file_name]) |
| 209 | 210 |
| 210 stdout_result = shellcmd(cmd, echo=args.echo_cmd) | 211 stdout_result = shellcmd(cmd, echo=args.echo_cmd) |
| 211 if not args.echo_cmd: | 212 if not args.echo_cmd: |
| 212 sys.stdout.write(stdout_result) | 213 sys.stdout.write(stdout_result) |
| 213 if asm_temp and not keep_output_file: | 214 if asm_temp and not keep_output_file: |
| 214 os.remove(output_file_name) | 215 os.remove(output_file_name) |
| 215 | 216 |
| 216 if __name__ == '__main__': | 217 if __name__ == '__main__': |
| 217 main() | 218 main() |
| OLD | NEW |