| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 '--undefined=_start', | 179 '--undefined=_start', |
| 180 '--defsym=__Sz_AbsoluteZero=0', | 180 '--defsym=__Sz_AbsoluteZero=0', |
| 181 '--defsym=_begin=0', | 181 '--defsym=_begin=0', |
| 182 '-o', exe | 182 '-o', exe |
| 183 ], echo=verbose) | 183 ], echo=verbose) |
| 184 | 184 |
| 185 def LinkNative(objs, exe, target, verbose=True): | 185 def LinkNative(objs, exe, target, verbose=True): |
| 186 nacl_root = FindBaseNaCl() | 186 nacl_root = FindBaseNaCl() |
| 187 linker = { | 187 linker = { |
| 188 'arm32': '/usr/bin/arm-linux-gnueabihf-g++', | 188 'arm32': '/usr/bin/arm-linux-gnueabihf-g++', |
| 189 'mips32': '/usr/bin/mipsel-linux-gnu-g++', |
| 189 'x8632': ('{root}/../third_party/llvm-build/Release+Asserts/bin/clang' | 190 'x8632': ('{root}/../third_party/llvm-build/Release+Asserts/bin/clang' |
| 190 ).format(root=nacl_root), | 191 ).format(root=nacl_root), |
| 191 'x8664': ('{root}/../third_party/llvm-build/Release+Asserts/bin/clang' | 192 'x8664': ('{root}/../third_party/llvm-build/Release+Asserts/bin/clang' |
| 192 ).format(root=nacl_root) | 193 ).format(root=nacl_root) |
| 193 }[target] | 194 }[target] |
| 194 | 195 |
| 195 extra_linker_args = { | 196 extra_linker_args = { |
| 196 'arm32': ['-mcpu=cortex-a9'], | 197 'arm32': ['-mcpu=cortex-a9'], |
| 197 'x8632': ['-m32'], | 198 'x8632': ['-m32'], |
| 198 'x8664': ['-mx32'] | 199 'x8664': ['-mx32'] |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 sym_sz = pexe_base + '.sym.sz.txt' | 291 sym_sz = pexe_base + '.sym.sz.txt' |
| 291 sym_sz_unescaped = pexe_base_unescaped + '.sym.sz.txt' | 292 sym_sz_unescaped = pexe_base_unescaped + '.sym.sz.txt' |
| 292 whitelist_sz = pexe_base + '.wl.sz.txt' | 293 whitelist_sz = pexe_base + '.wl.sz.txt' |
| 293 whitelist_sz_unescaped = pexe_base_unescaped + '.wl.sz.txt' | 294 whitelist_sz_unescaped = pexe_base_unescaped + '.wl.sz.txt' |
| 294 pnacl_sz = ( | 295 pnacl_sz = ( |
| 295 '{root}/toolchain_build/src/subzero/pnacl-sz' | 296 '{root}/toolchain_build/src/subzero/pnacl-sz' |
| 296 ).format(root=nacl_root) | 297 ).format(root=nacl_root) |
| 297 llcbin = '{base}/pnacl-llc'.format(base=path_addition) | 298 llcbin = '{base}/pnacl-llc'.format(base=path_addition) |
| 298 gold = '{base}/le32-nacl-ld.gold'.format(base=path_addition) | 299 gold = '{base}/le32-nacl-ld.gold'.format(base=path_addition) |
| 299 objcopy = '{base}/{objcopy}'.format(base=path_addition, | 300 objcopy = '{base}/{objcopy}'.format(base=path_addition, |
| 300 objcopy=GetObjcopyCmd()) | 301 objcopy=GetObjcopyCmd(args.target)) |
| 301 opt_level = args.optlevel | 302 opt_level = args.optlevel |
| 302 opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' } | 303 opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' } |
| 303 hybrid = args.include or args.exclude | 304 hybrid = args.include or args.exclude |
| 304 native = not args.sandbox and not args.nonsfi | 305 native = not args.sandbox and not args.nonsfi |
| 305 if args.asan: | 306 if args.asan: |
| 306 if args.sandbox or args.nonsfi: | 307 if args.sandbox or args.nonsfi: |
| 307 print 'Can only use AddressSanitizer with a native build' | 308 print 'Can only use AddressSanitizer with a native build' |
| 308 exit(1) | 309 exit(1) |
| 309 if '-fsanitize-address' not in args.sz_args: | 310 if '-fsanitize-address' not in args.sz_args: |
| 310 args.sz_args.append('-fsanitize-address') | 311 args.sz_args.append('-fsanitize-address') |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 466 |
| 466 # Put the extra verbose printing at the end. | 467 # Put the extra verbose printing at the end. |
| 467 if args.verbose and hybrid: | 468 if args.verbose and hybrid: |
| 468 print 'include={regex}'.format(regex=re_include_str) | 469 print 'include={regex}'.format(regex=re_include_str) |
| 469 print 'exclude={regex}'.format(regex=re_exclude_str) | 470 print 'exclude={regex}'.format(regex=re_exclude_str) |
| 470 print 'default_match={dm}'.format(dm=default_match) | 471 print 'default_match={dm}'.format(dm=default_match) |
| 471 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) | 472 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) |
| 472 | 473 |
| 473 if __name__ == '__main__': | 474 if __name__ == '__main__': |
| 474 main() | 475 main() |
| OLD | NEW |