| 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 shutil | 5 import shutil |
| 6 import tempfile | 6 import tempfile |
| 7 from utils import shellcmd | 7 from utils import shellcmd |
| 8 from utils import FindBaseNaCl | 8 from utils import FindBaseNaCl |
| 9 | 9 |
| 10 def Translate(ll_files, extra_args, obj, verbose): | 10 def Translate(ll_files, extra_args, obj, verbose): |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 '-pnacl-abi-simplify-postopt', | 67 '-pnacl-abi-simplify-postopt', |
| 68 '-pnaclabi-allow-debug-metadata', | 68 '-pnaclabi-allow-debug-metadata', |
| 69 '{dir}/szrt.tmp.bc'.format(dir=tempdir), | 69 '{dir}/szrt.tmp.bc'.format(dir=tempdir), |
| 70 '-S', | 70 '-S', |
| 71 '-o', '{dir}/szrt.ll'.format(dir=tempdir) | 71 '-o', '{dir}/szrt.ll'.format(dir=tempdir) |
| 72 ], echo=args.verbose) | 72 ], echo=args.verbose) |
| 73 ll_files = ['{dir}/szrt.ll'.format(dir=tempdir), | 73 ll_files = ['{dir}/szrt.ll'.format(dir=tempdir), |
| 74 '{srcdir}/szrt_ll.ll'.format(srcdir=srcdir)] | 74 '{srcdir}/szrt_ll.ll'.format(srcdir=srcdir)] |
| 75 # Translate tempdir/szrt.ll and srcdir/szrt_ll.ll to szrt_native_x8632.o | 75 # Translate tempdir/szrt.ll and srcdir/szrt_ll.ll to szrt_native_x8632.o |
| 76 Translate(ll_files, | 76 Translate(ll_files, |
| 77 ['-mtriple=i386-unknown-linux-gnu', '-mcpu=pentium4m'], | 77 ['-mtriple=i686', '-mcpu=pentium4m'], |
| 78 '{rtdir}/szrt_native_x8632.o'.format(rtdir=rtdir), | 78 '{rtdir}/szrt_native_x8632.o'.format(rtdir=rtdir), |
| 79 args.verbose) | 79 args.verbose) |
| 80 # Translate tempdir/szrt.ll and srcdir/szrt_ll.ll to szrt_sb_x8632.o | 80 # Translate tempdir/szrt.ll and srcdir/szrt_ll.ll to szrt_sb_x8632.o |
| 81 Translate(ll_files, | 81 Translate(ll_files, |
| 82 ['-mtriple=i686-none-nacl-gnu', '-mcpu=pentium4m'], | 82 ['-mtriple=i686-nacl', '-mcpu=pentium4m'], |
| 83 '{rtdir}/szrt_sb_x8632.o'.format(rtdir=rtdir), | 83 '{rtdir}/szrt_sb_x8632.o'.format(rtdir=rtdir), |
| 84 args.verbose) | 84 args.verbose) |
| 85 finally: | 85 finally: |
| 86 try: | 86 try: |
| 87 shutil.rmtree(tempdir) | 87 shutil.rmtree(tempdir) |
| 88 except OSError as exc: | 88 except OSError as exc: |
| 89 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory | 89 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory |
| 90 raise # re-raise exception | 90 raise # re-raise exception |
| 91 | 91 |
| 92 if __name__ == '__main__': | 92 if __name__ == '__main__': |
| 93 main() | 93 main() |
| OLD | NEW |