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 subprocess | 5 import subprocess |
6 import sys | 6 import sys |
7 import tempfile | 7 import tempfile |
8 | 8 |
9 from utils import shellcmd | 9 from utils import shellcmd |
10 from utils import FindBaseNaCl | 10 from utils import FindBaseNaCl |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 '-externalize', | 113 '-externalize', |
114 '-filetype=' + args.filetype, | 114 '-filetype=' + args.filetype, |
115 '-o=' + (obj_sz if args.filetype == 'obj' else asm_sz), | 115 '-o=' + (obj_sz if args.filetype == 'obj' else asm_sz), |
116 bitcode]) | 116 bitcode]) |
117 if args.filetype != 'obj': | 117 if args.filetype != 'obj': |
118 shellcmd(['{bin}/llvm-mc'.format(bin=bindir), | 118 shellcmd(['{bin}/llvm-mc'.format(bin=bindir), |
119 '-triple=' + triple, | 119 '-triple=' + triple, |
120 '-filetype=obj', | 120 '-filetype=obj', |
121 '-o=' + obj_sz, | 121 '-o=' + obj_sz, |
122 asm_sz]) | 122 asm_sz]) |
| 123 # Each separately translated Subzero object file contains its own |
| 124 # definition of the __Sz_block_profile_info profiling symbol. Avoid |
| 125 # linker errors (multiply defined symbol) by making all copies weak. |
| 126 # (This could also be done by Subzero if it supported weak symbol |
| 127 # definitions.) This approach should be OK because cross tests are |
| 128 # currently the only situation where multiple translated files are |
| 129 # linked into the executable, but when PNaCl supports shared nexe |
| 130 # libraries, this would need to change. |
| 131 shellcmd(['objcopy', '--weaken-symbol=__Sz_block_profile_info', obj_sz]) |
123 objs.append(obj_sz) | 132 objs.append(obj_sz) |
124 if args.crosstest_bitcode: | 133 if args.crosstest_bitcode: |
125 shellcmd(['{bin}/pnacl-llc'.format(bin=bindir), | 134 shellcmd(['{bin}/pnacl-llc'.format(bin=bindir), |
126 '-mtriple=' + triple, | 135 '-mtriple=' + triple, |
127 # Use sse2 instructions regardless of input -mattr | 136 # Use sse2 instructions regardless of input -mattr |
128 # argument to avoid differences in (undefined) behavior of | 137 # argument to avoid differences in (undefined) behavior of |
129 # converting NaN to int. | 138 # converting NaN to int. |
130 '-mattr=sse2', | 139 '-mattr=sse2', |
131 '-externalize', | 140 '-externalize', |
132 '-filetype=obj', | 141 '-filetype=obj', |
(...skipping 16 matching lines...) Expand all Loading... |
149 sb_native_args = (['-O0', '--pnacl-allow-native', '-arch', 'x8632', | 158 sb_native_args = (['-O0', '--pnacl-allow-native', '-arch', 'x8632', |
150 '-Wn,-defsym=__Sz_AbsoluteZero=0'] | 159 '-Wn,-defsym=__Sz_AbsoluteZero=0'] |
151 if args.sandbox else | 160 if args.sandbox else |
152 ['-g', '-m32', '-lm', '-lpthread', | 161 ['-g', '-m32', '-lm', '-lpthread', |
153 '-Wl,--defsym=__Sz_AbsoluteZero=0']) | 162 '-Wl,--defsym=__Sz_AbsoluteZero=0']) |
154 shellcmd([compiler, args.driver] + objs + | 163 shellcmd([compiler, args.driver] + objs + |
155 ['-o', os.path.join(args.dir, args.output)] + sb_native_args) | 164 ['-o', os.path.join(args.dir, args.output)] + sb_native_args) |
156 | 165 |
157 if __name__ == '__main__': | 166 if __name__ == '__main__': |
158 main() | 167 main() |
OLD | NEW |