 Chromium Code Reviews
 Chromium Code Reviews Issue 944333002:
  Subzero: Update tests and build scripts for sandboxing.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
    
  
    Issue 944333002:
  Subzero: Update tests and build scripts for sandboxing.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 '-O' + args.optlevel, | 106 '-O' + args.optlevel, | 
| 107 '-mattr=' + args.attr, | 107 '-mattr=' + args.attr, | 
| 108 '--target=' + args.target, | 108 '--target=' + args.target, | 
| 109 '--prefix=' + args.prefix, | 109 '--prefix=' + args.prefix, | 
| 110 '-allow-uninitialized-globals', | 110 '-allow-uninitialized-globals', | 
| 111 '-filetype=' + args.filetype, | 111 '-filetype=' + args.filetype, | 
| 112 '-o=' + (obj_sz if args.filetype == 'obj' else asm_sz), | 112 '-o=' + (obj_sz if args.filetype == 'obj' else asm_sz), | 
| 113 bitcode]) | 113 bitcode]) | 
| 114 if args.filetype != 'obj': | 114 if args.filetype != 'obj': | 
| 115 shellcmd(['llvm-mc', | 115 shellcmd(['llvm-mc', | 
| 116 '-arch=' + arch_map[args.target], | 116 '-arch=' + arch_map[args.target], | 
| 
jvoung (off chromium)
2015/02/23 23:58:38
I guess this llvm-mc invocation is always native,
 
Jim Stichnoth
2015/02/24 00:37:57
Done.  (and tested by temporarily changing default
 | |
| 117 '-filetype=obj', | 117 '-filetype=obj', | 
| 118 '-o=' + obj_sz, | 118 '-o=' + obj_sz, | 
| 119 asm_sz]) | 119 asm_sz]) | 
| 120 objs.append(obj_sz) | 120 objs.append(obj_sz) | 
| 121 # Each original bitcode file needs to be translated by the | 121 # Each original bitcode file needs to be translated by the | 
| 122 # LLVM toolchain and have its object file linked in. There | 122 # LLVM toolchain and have its object file linked in. There | 
| 123 # are two ways to do this: explicitly use llc, or include the | 123 # are two ways to do this: explicitly use llc, or include the | 
| 124 # .ll file in the link command. It turns out that these two | 124 # .ll file in the link command. It turns out that these two | 
| 125 # approaches can produce different semantics on some undefined | 125 # approaches can produce different semantics on some undefined | 
| 126 # bitcode behavior. Specifically, LLVM produces different | 126 # bitcode behavior. Specifically, LLVM produces different | 
| (...skipping 10 matching lines...) Expand all Loading... | |
| 137 objs.append(arg) | 137 objs.append(arg) | 
| 138 elif use_llc: | 138 elif use_llc: | 
| 139 shellcmd(['llc' | 139 shellcmd(['llc' | 
| 140 '-filetype=obj', | 140 '-filetype=obj', | 
| 141 '-o=' + obj_llc, | 141 '-o=' + obj_llc, | 
| 142 bitcode]) | 142 bitcode]) | 
| 143 objs.append(obj_llc) | 143 objs.append(obj_llc) | 
| 144 else: | 144 else: | 
| 145 objs.append(bitcode) | 145 objs.append(bitcode) | 
| 146 | 146 | 
| 147 # Use 'clang szrt.c' -or- 'clang++ szrt.cpp' | |
| 148 objs.append(( | 147 objs.append(( | 
| 149 '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}' | 148 '{root}/toolchain_build/src/subzero/build/runtime/' + | 
| 150 ).format(root=nacl_root, ext='c' if pure_c else 'cpp')) | 149 'szrt_native_x8632.o' | 
| 151 objs.append(( | |
| 152 '{root}/toolchain_build/src/subzero/runtime/szrt_i686.ll' | |
| 153 ).format(root=nacl_root)) | 150 ).format(root=nacl_root)) | 
| 154 linker = 'clang' if pure_c else 'clang++' | 151 linker = 'clang' if pure_c else 'clang++' | 
| 155 shellcmd([linker, '-g', '-m32', args.driver] + | 152 shellcmd([linker, '-g', '-m32', args.driver] + | 
| 156 objs + | 153 objs + | 
| 157 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) | 154 ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)]) | 
| OLD | NEW |