 Chromium Code Reviews
 Chromium Code Reviews Issue 2128643002:
  Fixed instruction corruption bug for multiple returns.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
    
  
    Issue 2128643002:
  Fixed instruction corruption bug for multiple returns.  (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 pipes | 5 import pipes | 
| 6 import re | 6 import re | 
| 7 import sys | 7 import sys | 
| 8 | 8 | 
| 9 from utils import FindBaseNaCl, GetObjcopyCmd, get_sfi_string, shellcmd | 9 from utils import FindBaseNaCl, GetObjcopyCmd, get_sfi_string, shellcmd | 
| 10 | 10 | 
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 --install=toolchain/linux_x86/pnacl_newlib_raw | 259 --install=toolchain/linux_x86/pnacl_newlib_raw | 
| 260 """ | 260 """ | 
| 261 argparser = argparse.ArgumentParser( | 261 argparser = argparse.ArgumentParser( | 
| 262 description=' ' + main.__doc__, | 262 description=' ' + main.__doc__, | 
| 263 formatter_class=argparse.RawTextHelpFormatter) | 263 formatter_class=argparse.RawTextHelpFormatter) | 
| 264 AddOptionalArgs(argparser) | 264 AddOptionalArgs(argparser) | 
| 265 argparser.add_argument('pexe', help='Finalized pexe to translate') | 265 argparser.add_argument('pexe', help='Finalized pexe to translate') | 
| 266 args = argparser.parse_args() | 266 args = argparser.parse_args() | 
| 267 pexe = args.pexe | 267 pexe = args.pexe | 
| 268 exe = args.output | 268 exe = args.output | 
| 269 if args.asan: | |
| 270 if args.sandbox or args.nonsfi: | |
| 271 print 'Can only use AddressSanitizer with a native build' | |
| 272 exit(1) | |
| 273 args.sz_args.append('-fsanitize-address') | |
| 274 ProcessPexe(args, pexe, exe) | 269 ProcessPexe(args, pexe, exe) | 
| 275 | 270 | 
| 276 def ProcessPexe(args, pexe, exe): | 271 def ProcessPexe(args, pexe, exe): | 
| 277 [pexe_base, ext] = os.path.splitext(pexe) | 272 [pexe_base, ext] = os.path.splitext(pexe) | 
| 278 if ext != '.pexe': | 273 if ext != '.pexe': | 
| 279 pexe_base = pexe | 274 pexe_base = pexe | 
| 280 pexe_base_unescaped = pexe_base | 275 pexe_base_unescaped = pexe_base | 
| 281 pexe_base = pipes.quote(pexe_base) | 276 pexe_base = pipes.quote(pexe_base) | 
| 282 pexe = pipes.quote(pexe) | 277 pexe = pipes.quote(pexe) | 
| 283 | 278 | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 300 '{root}/toolchain_build/src/subzero/pnacl-sz' | 295 '{root}/toolchain_build/src/subzero/pnacl-sz' | 
| 301 ).format(root=nacl_root) | 296 ).format(root=nacl_root) | 
| 302 llcbin = '{base}/pnacl-llc'.format(base=path_addition) | 297 llcbin = '{base}/pnacl-llc'.format(base=path_addition) | 
| 303 gold = '{base}/le32-nacl-ld.gold'.format(base=path_addition) | 298 gold = '{base}/le32-nacl-ld.gold'.format(base=path_addition) | 
| 304 objcopy = '{base}/{objcopy}'.format(base=path_addition, | 299 objcopy = '{base}/{objcopy}'.format(base=path_addition, | 
| 305 objcopy=GetObjcopyCmd()) | 300 objcopy=GetObjcopyCmd()) | 
| 306 opt_level = args.optlevel | 301 opt_level = args.optlevel | 
| 307 opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' } | 302 opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' } | 
| 308 hybrid = args.include or args.exclude | 303 hybrid = args.include or args.exclude | 
| 309 native = not args.sandbox and not args.nonsfi | 304 native = not args.sandbox and not args.nonsfi | 
| 305 if args.asan: | |
| 306 if args.sandbox or args.nonsfi: | |
| 307 print 'Can only use AddressSanitizer with a native build' | |
| 308 exit(1) | |
| 309 if '-fsanitize-address' not in args.sz_args: | |
| 310 args.sz_args.append('-fsanitize-address') | |
| 
tlively
2016/07/06 19:47:05
This redundancy check is necessary because szbuild
 | |
| 310 | 311 | 
| 311 if hybrid and (args.force or | 312 if hybrid and (args.force or | 
| 312 NewerThanOrNotThere(pexe, obj_llc) or | 313 NewerThanOrNotThere(pexe, obj_llc) or | 
| 313 NewerThanOrNotThere(llcbin, obj_llc)): | 314 NewerThanOrNotThere(llcbin, obj_llc)): | 
| 314 arch = { | 315 arch = { | 
| 315 'arm32': 'arm' + get_sfi_string(args, 'v7', '-nonsfi', '-nonsfi'), | 316 'arm32': 'arm' + get_sfi_string(args, 'v7', '-nonsfi', '-nonsfi'), | 
| 316 'x8632': 'x86-32' + get_sfi_string(args, '', '-nonsfi', '-linux'), | 317 'x8632': 'x86-32' + get_sfi_string(args, '', '-nonsfi', '-linux'), | 
| 317 'x8664': 'x86-64' + get_sfi_string(args, '', '', '-linux') | 318 'x8664': 'x86-64' + get_sfi_string(args, '', '', '-linux') | 
| 318 }[args.target] | 319 }[args.target] | 
| 319 | 320 | 
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 | 465 | 
| 465 # Put the extra verbose printing at the end. | 466 # Put the extra verbose printing at the end. | 
| 466 if args.verbose and hybrid: | 467 if args.verbose and hybrid: | 
| 467 print 'include={regex}'.format(regex=re_include_str) | 468 print 'include={regex}'.format(regex=re_include_str) | 
| 468 print 'exclude={regex}'.format(regex=re_exclude_str) | 469 print 'exclude={regex}'.format(regex=re_exclude_str) | 
| 469 print 'default_match={dm}'.format(dm=default_match) | 470 print 'default_match={dm}'.format(dm=default_match) | 
| 470 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) | 471 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) | 
| 471 | 472 | 
| 472 if __name__ == '__main__': | 473 if __name__ == '__main__': | 
| 473 main() | 474 main() | 
| OLD | NEW |