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', | 108 '-build-on-read=0', |
Jim Stichnoth
2014/10/31 20:55:19
One can add:
'-ias=0',
to test the AT&T emit syn
| |
109 '-o=' + asm_sz, | 109 '-o=' + asm_sz, |
110 bitcode]) | 110 bitcode]) |
111 shellcmd(['llvm-mc', | 111 shellcmd(['llvm-mc', |
112 '-arch=' + arch_map[args.target], | 112 '-arch=' + arch_map[args.target], |
113 '-x86-asm-syntax=intel', | |
114 '-filetype=obj', | 113 '-filetype=obj', |
115 '-o=' + obj_sz, | 114 '-o=' + obj_sz, |
116 asm_sz]) | 115 asm_sz]) |
117 objs.append(obj_sz) | 116 objs.append(obj_sz) |
118 # Each original bitcode file needs to be translated by the | 117 # Each original bitcode file needs to be translated by the |
119 # LLVM toolchain and have its object file linked in. There | 118 # LLVM toolchain and have its object file linked in. There |
120 # are two ways to do this: explicitly use llc, or include the | 119 # are two ways to do this: explicitly use llc, or include the |
121 # .ll file in the link command. It turns out that these two | 120 # .ll file in the link command. It turns out that these two |
122 # approaches can produce different semantics on some undefined | 121 # approaches can produce different semantics on some undefined |
123 # bitcode behavior. Specifically, LLVM produces different | 122 # bitcode behavior. Specifically, LLVM produces different |
(...skipping 21 matching lines...) Expand all Loading... | |
145 objs.append(( | 144 objs.append(( |
146 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' | 145 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' |
147 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) | 146 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) |
148 objs.append(( | 147 objs.append(( |
149 '{root}/toolchain_build/src/subzero/runtime/szrt_i686.ll' | 148 '{root}/toolchain_build/src/subzero/runtime/szrt_i686.ll' |
150 ).format(root=nacl_root)) | 149 ).format(root=nacl_root)) |
151 linker = 'clang' if pure_c else 'clang++' | 150 linker = 'clang' if pure_c else 'clang++' |
152 shellcmd([linker, '-g', '-m32', args.driver] + | 151 shellcmd([linker, '-g', '-m32', args.driver] + |
153 objs + | 152 objs + |
154 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) | 153 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) |
OLD | NEW |