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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 base_sz = '%s.O%s.%s.%s' % (base, args.optlevel, args.attr, args.target) | 98 base_sz = '%s.O%s.%s.%s' % (base, args.optlevel, args.attr, args.target) |
99 asm_sz = os.path.join(args.dir, base_sz + '.sz.s') | 99 asm_sz = os.path.join(args.dir, base_sz + '.sz.s') |
100 obj_sz = os.path.join(args.dir, base_sz + '.sz.o') | 100 obj_sz = os.path.join(args.dir, base_sz + '.sz.o') |
101 obj_llc = os.path.join(args.dir, base + '.llc.o') | 101 obj_llc = os.path.join(args.dir, base + '.llc.o') |
102 shellcmd(['../llvm2ice', | 102 shellcmd(['../llvm2ice', |
103 '-O' + args.optlevel, | 103 '-O' + args.optlevel, |
104 '-mattr=' + args.attr, | 104 '-mattr=' + args.attr, |
105 '--target=' + args.target, | 105 '--target=' + args.target, |
106 '--prefix=' + args.prefix, | 106 '--prefix=' + args.prefix, |
107 '-allow-uninitialized-globals', | 107 '-allow-uninitialized-globals', |
108 '-build-on-read=0', | |
109 '-o=' + asm_sz, | 108 '-o=' + asm_sz, |
110 bitcode]) | 109 bitcode]) |
111 shellcmd(['llvm-mc', | 110 shellcmd(['llvm-mc', |
112 '-arch=' + arch_map[args.target], | 111 '-arch=' + arch_map[args.target], |
113 '-filetype=obj', | 112 '-filetype=obj', |
114 '-o=' + obj_sz, | 113 '-o=' + obj_sz, |
115 asm_sz]) | 114 asm_sz]) |
116 objs.append(obj_sz) | 115 objs.append(obj_sz) |
117 # Each original bitcode file needs to be translated by the | 116 # Each original bitcode file needs to be translated by the |
118 # LLVM toolchain and have its object file linked in. There | 117 # LLVM toolchain and have its object file linked in. There |
(...skipping 25 matching lines...) Expand all Loading... |
144 objs.append(( | 143 objs.append(( |
145 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' | 144 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' |
146 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) | 145 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) |
147 objs.append(( | 146 objs.append(( |
148 '{root}/toolchain_build/src/subzero/runtime/szrt_i686.ll' | 147 '{root}/toolchain_build/src/subzero/runtime/szrt_i686.ll' |
149 ).format(root=nacl_root)) | 148 ).format(root=nacl_root)) |
150 linker = 'clang' if pure_c else 'clang++' | 149 linker = 'clang' if pure_c else 'clang++' |
151 shellcmd([linker, '-g', '-m32', args.driver] + | 150 shellcmd([linker, '-g', '-m32', args.driver] + |
152 objs + | 151 objs + |
153 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) | 152 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) |
OLD | NEW |