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 104 matching lines...) Loading... |
115 # approaches can produce different semantics on some undefined | 115 # approaches can produce different semantics on some undefined |
116 # bitcode behavior. Specifically, LLVM produces different | 116 # bitcode behavior. Specifically, LLVM produces different |
117 # results for overflowing fptoui instructions for i32 and i64 | 117 # results for overflowing fptoui instructions for i32 and i64 |
118 # on x86-32. As it turns out, Subzero lowering was based on | 118 # on x86-32. As it turns out, Subzero lowering was based on |
119 # inspecting the object code produced by the direct llc | 119 # inspecting the object code produced by the direct llc |
120 # command, so we need to directly run llc on the bitcode, even | 120 # command, so we need to directly run llc on the bitcode, even |
121 # though it makes this script longer, to avoid spurious | 121 # though it makes this script longer, to avoid spurious |
122 # failures. This behavior can be inspected by switching | 122 # failures. This behavior can be inspected by switching |
123 # use_llc between True and False. | 123 # use_llc between True and False. |
124 use_llc = False | 124 use_llc = False |
| 125 pure_c = os.path.splitext(args.driver)[1] == '.c' |
125 if not args.crosstest_bitcode: | 126 if not args.crosstest_bitcode: |
126 objs.append(arg) | 127 objs.append(arg) |
127 elif use_llc: | 128 elif use_llc: |
128 shellcmd(['llc' | 129 shellcmd(['llc' |
129 '-filetype=obj', | 130 '-filetype=obj', |
130 '-o=' + obj_llc, | 131 '-o=' + obj_llc, |
131 bitcode]) | 132 bitcode]) |
132 objs.append(obj_llc) | 133 objs.append(obj_llc) |
133 else: | 134 else: |
134 objs.append(bitcode) | 135 objs.append(bitcode) |
135 | 136 |
136 linker = 'clang' if os.path.splitext(args.driver)[1] == '.c' else 'clang++' | 137 # Use 'clang szrt.c' -or- 'clang++ szrt.cpp' |
| 138 objs.append(( |
| 139 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' |
| 140 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) |
| 141 linker = 'clang' if pure_c else 'clang++' |
137 shellcmd([linker, '-g', '-m32', args.driver] + | 142 shellcmd([linker, '-g', '-m32', args.driver] + |
138 objs + | 143 objs + |
139 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) | 144 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) |
OLD | NEW |