| 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 | 7 |
| 8 import targets | 8 import targets |
| 9 from utils import shellcmd | 9 from utils import shellcmd |
| 10 from utils import FindBaseNaCl | 10 from utils import FindBaseNaCl |
| 11 | 11 |
| 12 | 12 |
| 13 def Translate(ll_files, extra_args, obj, verbose): | 13 def Translate(ll_files, extra_args, obj, verbose): |
| 14 """Translate a set of input bitcode files into a single object file. | 14 """Translate a set of input bitcode files into a single object file. |
| 15 | 15 |
| 16 Use pnacl-llc to translate textual bitcode input ll_files into object file | 16 Use pnacl-llc to translate textual bitcode input ll_files into object file |
| 17 obj, using extra_args as the architectural flags. | 17 obj, using extra_args as the architectural flags. |
| 18 """ | 18 """ |
| 19 shellcmd(['cat'] + ll_files + ['|', | 19 shellcmd(['cat'] + ll_files + ['|', |
| 20 'pnacl-llc', | 20 'pnacl-llc', |
| 21 '-externalize', | 21 '-externalize', |
| 22 '-function-sections', | 22 '-function-sections', |
| 23 '-O2', | 23 '-O2', |
| 24 '-filetype=obj', | 24 '-filetype=obj', |
| 25 '-bitcode-format=llvm', | 25 '-bitcode-format=llvm', |
| 26 '-arm-enable-dwarf-eh=1', |
| 26 '-o', obj | 27 '-o', obj |
| 27 ] + extra_args, echo=verbose) | 28 ] + extra_args, echo=verbose) |
| 28 shellcmd(['le32-nacl-objcopy', | 29 shellcmd(['le32-nacl-objcopy', |
| 29 '--strip-symbol=nacl_tp_tdb_offset', | 30 '--strip-symbol=nacl_tp_tdb_offset', |
| 30 '--strip-symbol=nacl_tp_tls_offset', | 31 '--strip-symbol=nacl_tp_tls_offset', |
| 31 obj | 32 obj |
| 32 ], echo=verbose) | 33 ], echo=verbose) |
| 33 | 34 |
| 34 | 35 |
| 35 def PartialLink(obj_files, extra_args, lib, verbose): | 36 def PartialLink(obj_files, extra_args, lib, verbose): |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 172 |
| 172 finally: | 173 finally: |
| 173 try: | 174 try: |
| 174 shutil.rmtree(tempdir) | 175 shutil.rmtree(tempdir) |
| 175 except OSError as exc: | 176 except OSError as exc: |
| 176 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory | 177 if exc.errno != errno.ENOENT: # ENOENT - no such file or directory |
| 177 raise # re-raise exception | 178 raise # re-raise exception |
| 178 | 179 |
| 179 if __name__ == '__main__': | 180 if __name__ == '__main__': |
| 180 main() | 181 main() |
| OLD | NEW |