Chromium Code Reviews| Index: pydir/szbuild.py |
| diff --git a/pydir/szbuild.py b/pydir/szbuild.py |
| index 558db48db863f6324c491d87845efdcc74a0bd1c..636639198ae8d6fb821797e86f1e64ccb361f740 100755 |
| --- a/pydir/szbuild.py |
| +++ b/pydir/szbuild.py |
| @@ -103,6 +103,9 @@ def AddOptionalArgs(argparser): |
| default=[], help='Extra arguments for llc') |
| argparser.add_argument('--no-sz', dest='nosz', action='store_true', |
| help='Run only post-Subzero build steps') |
| + argparser.add_argument('--fsanitize-address', dest='asan', |
| + action='store_true', |
| + help='Instrument with AddressSanitizer') |
| def LinkSandbox(objs, exe, target, verbose=True): |
| assert target in ('x8632', 'x8664', 'arm32'), \ |
| @@ -263,6 +266,12 @@ def main(): |
| args = argparser.parse_args() |
| pexe = args.pexe |
| exe = args.output |
| + if args.asan: |
| + if args.sandbox or args.nonsfi: |
| + print 'Can only use AddressSanitizer with a native build' |
| + exit() |
| + if not '-fsanitize-address' in args.sz_args: |
| + args.sz_args.append('-fsanitize-address') |
|
Jim Stichnoth
2016/06/15 05:21:16
I think you still want to append -fsanitize-addres
tlively
2016/06/15 16:32:00
Done.
|
| ProcessPexe(args, pexe, exe) |
| def ProcessPexe(args, pexe, exe): |
| @@ -446,7 +455,13 @@ def ProcessPexe(args, pexe, exe): |
| elif args.nonsfi: |
| LinkNonsfi([obj_partial], exe, args.target, args.verbose) |
| else: |
| - LinkNative([obj_partial], exe, args.target, args.verbose) |
| + objs = [obj_partial] |
| + if args.asan: |
| + objs.append( |
| + ('{root}/toolchain_build/src/subzero/build/runtime/' + |
| + 'szrt_asan_{target}.o').format(root=nacl_root, |
| + target=args.target)) |
| + LinkNative(objs, exe, args.target, args.verbose) |
| # Put the extra verbose printing at the end. |
| if args.verbose and hybrid: |