summaryrefslogtreecommitdiff
path: root/tools/nativize_llvm.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/nativize_llvm.py')
-rwxr-xr-xtools/nativize_llvm.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/nativize_llvm.py b/tools/nativize_llvm.py
index de78dce2..d9558c32 100755
--- a/tools/nativize_llvm.py
+++ b/tools/nativize_llvm.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
'''
Small utility to build some llvm bitcode into native code. Useful when lli (called
@@ -23,9 +23,12 @@ libs = sys.argv[2:] # e.g.: dl for dlopen/dlclose, util for openpty/forkpty
print 'bc => clean bc'
Popen([LLVM_OPT, filename, '-strip-debug', '-o=' + filename + '.clean.bc']).communicate()[0]
print 'bc => s'
-Popen([LLVM_COMPILER, filename + '.clean.bc', '-o=' + filename + '.s']).communicate()[0]
-print 's => o'
-Popen(['as', filename + '.s', '-o', filename + '.o']).communicate()[0]
+for params in [[], ['-march=x86-64']]: # try x86, then x86-64 FIXME
+ print 'params', params
+ Popen([LLVM_COMPILER] + params + [filename + '.clean.bc', '-o=' + filename + '.s']).communicate()[0]
+ print 's => o'
+ Popen(['as', filename + '.s', '-o', filename + '.o']).communicate()[0]
+ if os.path.exists(filename + '.o'): break
print 'o => runnable'
Popen(['g++', path_from_root('system', 'lib', 'debugging.cpp'), filename + '.o', '-o', filename + '.run'] + ['-l' + lib for lib in libs]).communicate()[0]