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 shellcmd | 9 from utils import shellcmd |
10 from utils import FindBaseNaCl | 10 from utils import FindBaseNaCl |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 '-O' + opt_level, | 195 '-O' + opt_level, |
196 '-bitcode-format=pnacl', | 196 '-bitcode-format=pnacl', |
197 '-externalize', | 197 '-externalize', |
198 '-ffunction-sections', | 198 '-ffunction-sections', |
199 '-fdata-sections', | 199 '-fdata-sections', |
200 '-o', asm_sz] + | 200 '-o', asm_sz] + |
201 args.sz_args + | 201 args.sz_args + |
202 [pexe], | 202 [pexe], |
203 echo=args.verbose) | 203 echo=args.verbose) |
204 shellcmd(( | 204 shellcmd(( |
205 'llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj -o {obj} ' + | 205 'llvm-mc -arch=x86 -filetype=obj -o {obj} {asm}' |
206 '{asm}' | |
207 ).format(asm=asm_sz, obj=obj_sz), echo=args.verbose) | 206 ).format(asm=asm_sz, obj=obj_sz), echo=args.verbose) |
208 shellcmd(( | 207 shellcmd(( |
209 'objcopy --redefine-sym _start=_user_start {obj}' | 208 'objcopy --redefine-sym _start=_user_start {obj}' |
210 ).format(obj=obj_sz), echo=args.verbose) | 209 ).format(obj=obj_sz), echo=args.verbose) |
211 shellcmd(( | 210 shellcmd(( |
212 'nm {obj} | sed -n "s/.* [a-zA-Z] //p" > {sym}' | 211 'nm {obj} | sed -n "s/.* [a-zA-Z] //p" > {sym}' |
213 ).format(obj=obj_sz, sym=sym_sz), echo=args.verbose) | 212 ).format(obj=obj_sz, sym=sym_sz), echo=args.verbose) |
214 | 213 |
215 with open(sym_sz_unescaped) as f: | 214 with open(sym_sz_unescaped) as f: |
216 sz_syms = f.read().splitlines() | 215 sz_syms = f.read().splitlines() |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 # Put the extra verbose printing at the end. | 269 # Put the extra verbose printing at the end. |
271 if args.verbose: | 270 if args.verbose: |
272 print 'PATH={path}'.format(path=os.environ['PATH']) | 271 print 'PATH={path}'.format(path=os.environ['PATH']) |
273 print 'include={regex}'.format(regex=re_include_str) | 272 print 'include={regex}'.format(regex=re_include_str) |
274 print 'exclude={regex}'.format(regex=re_exclude_str) | 273 print 'exclude={regex}'.format(regex=re_exclude_str) |
275 print 'default_match={dm}'.format(dm=default_match) | 274 print 'default_match={dm}'.format(dm=default_match) |
276 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) | 275 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) |
277 | 276 |
278 if __name__ == '__main__': | 277 if __name__ == '__main__': |
279 main() | 278 main() |
OLD | NEW |