| 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 import targets | 9 import targets |
| 10 from utils import shellcmd | 10 from utils import shellcmd |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 else: | 175 else: |
| 176 objs.append(arg) | 176 objs.append(arg) |
| 177 | 177 |
| 178 # Add szrt_sb_${target}.o or szrt_native_${target}.o. | 178 # Add szrt_sb_${target}.o or szrt_native_${target}.o. |
| 179 objs.append(( | 179 objs.append(( |
| 180 '{root}/toolchain_build/src/subzero/build/runtime/' + | 180 '{root}/toolchain_build/src/subzero/build/runtime/' + |
| 181 'szrt_{sb}_' + args.target + '.o' | 181 'szrt_{sb}_' + args.target + '.o' |
| 182 ).format(root=nacl_root, sb='sb' if args.sandbox else 'native')) | 182 ).format(root=nacl_root, sb='sb' if args.sandbox else 'native')) |
| 183 pure_c = os.path.splitext(args.driver)[1] == '.c' | 183 pure_c = os.path.splitext(args.driver)[1] == '.c' |
| 184 | 184 |
| 185 # TargetX8664 is ilp32, but clang does not currently support such | 185 # TargetX8664 is ilp32, but pnacl-clang does not currently support such |
| 186 # configuration. In order to run the crosstests we play nasty, dangerous | 186 # configuration. In order to run the crosstests we play nasty, dangerous |
| 187 # tricks with the stack pointer. | 187 # tricks with the stack pointer. |
| 188 needs_stack_hack = (args.target == 'x8664') | 188 needs_stack_hack = (args.target == 'x8664') |
| 189 target_params = [] | 189 target_params = [] |
| 190 if needs_stack_hack: | 190 if needs_stack_hack: |
| 191 shellcmd('{bin}/clang -g -o stack_hack.x8664.{key}.o -c ' | 191 shellcmd('{bin}/clang -g -o stack_hack.x8664.{key}.o -c ' |
| 192 'stack_hack.x8664.c'.format(bin=bindir, key=key)) | 192 'stack_hack.x8664.c'.format(bin=bindir, key=key)) |
| 193 target_params.append('-DX8664_STACK_HACK') | 193 target_params.append('-DX8664_STACK_HACK') |
| 194 target_params.append('stack_hack.x8664.{key}.o'.format(key=key)) | 194 target_params.append('stack_hack.x8664.{key}.o'.format(key=key)) |
| 195 | 195 |
| 196 if args.target == 'arm32': | 196 if args.target == 'arm32': |
| 197 target_params.append('-DARM32') | 197 target_params.append('-DARM32') |
| 198 target_params.append('-static') | 198 target_params.append('-static') |
| 199 | 199 |
| 200 # Set compiler to clang, clang++, pnacl-clang, or pnacl-clang++. | 200 # Set compiler to clang, clang++, pnacl-clang, or pnacl-clang++. |
| 201 compiler = '{bin}/{prefix}{cc}'.format( | 201 compiler = '{bin}/{prefix}{cc}'.format( |
| 202 bin=bindir, prefix='pnacl-' if args.sandbox else '', | 202 bin=bindir, prefix='pnacl-' if args.sandbox else '', |
| 203 cc='clang' if pure_c else 'clang++') | 203 cc='clang' if pure_c else 'clang++') |
| 204 sb_native_args = (['-O0', '--pnacl-allow-native', | 204 sb_native_args = (['-O0', '--pnacl-allow-native', |
| 205 '-arch', target_info.target, | 205 '-arch', target_info.compiler_arch, |
| 206 '-Wn,-defsym=__Sz_AbsoluteZero=0'] | 206 '-Wn,-defsym=__Sz_AbsoluteZero=0'] |
| 207 if args.sandbox else | 207 if args.sandbox else |
| 208 ['-g', '-target=' + triple, | 208 ['-g', '-target=' + triple, |
| 209 '-lm', '-lpthread', | 209 '-lm', '-lpthread', |
| 210 '-Wl,--defsym=__Sz_AbsoluteZero=0'] + | 210 '-Wl,--defsym=__Sz_AbsoluteZero=0'] + |
| 211 target_info.cross_headers) | 211 target_info.cross_headers) |
| 212 shellcmd([compiler] + target_params + [args.driver] + objs + | 212 shellcmd([compiler] + target_params + [args.driver] + objs + |
| 213 ['-o', os.path.join(args.dir, args.output)] + sb_native_args) | 213 ['-o', os.path.join(args.dir, args.output)] + sb_native_args) |
| 214 | 214 |
| 215 if __name__ == '__main__': | 215 if __name__ == '__main__': |
| 216 main() | 216 main() |
| OLD | NEW |