| Index: pydir/run-pnacl-sz.py
|
| diff --git a/pydir/run-pnacl-sz.py b/pydir/run-pnacl-sz.py
|
| index 2d86a35d863a9c0a554801472036df88885c61b7..e15b0960114162262d5b30fcdf01b160ec4eb22c 100755
|
| --- a/pydir/run-pnacl-sz.py
|
| +++ b/pydir/run-pnacl-sz.py
|
| @@ -10,6 +10,22 @@ import tempfile
|
|
|
| from utils import shellcmd
|
|
|
| +
|
| +def TargetAssemblerFlags(target):
|
| + # TODO(stichnot): -triple=i686-nacl should be used for a
|
| + # sandboxing test. This means there should be an args.sandbox
|
| + # argument that also gets passed through to pnacl-sz.
|
| + flags = { 'x8632': ['-triple=i686'],
|
| + 'arm32': ['-triple=armv7a', '-mcpu=cortex-a9', '-mattr=+neon'] }
|
| + return flags[target]
|
| +
|
| +
|
| +def TargetDisassemblerFlags(target):
|
| + flags = { 'x8632': ['-Mintel'],
|
| + 'arm32': [] }
|
| + return flags[target]
|
| +
|
| +
|
| def main():
|
| """Run the pnacl-sz compiler on an llvm file.
|
|
|
| @@ -56,6 +72,9 @@ def main():
|
| argparser.add_argument('--filetype', default='iasm', dest='filetype',
|
| choices=['obj', 'asm', 'iasm'],
|
| help='Output file type. Default %(default)s.')
|
| + argparser.add_argument('--target', default='x8632', dest='target',
|
| + choices=['x8632','arm32'],
|
| + help='Target architecture. Default %(default)s.')
|
| argparser.add_argument('--echo-cmd', required=False,
|
| action='store_true',
|
| help='Trace command that generates ICE instructions')
|
| @@ -82,6 +101,7 @@ def main():
|
| cmd += ['--allow-local-symbol-tables']
|
| cmd += ['|']
|
| cmd += [args.pnacl_sz]
|
| + cmd += ['--target', args.target]
|
| if args.insts:
|
| # If the tests are based on '-verbose inst' output, force
|
| # single-threaded translation because dump output does not get
|
| @@ -107,19 +127,17 @@ def main():
|
| asm_temp = tempfile.NamedTemporaryFile(delete=False)
|
| asm_temp.close()
|
| if args.assemble and args.filetype != 'obj':
|
| - cmd += ['|', os.path.join(pnacl_bin_path, 'llvm-mc'),
|
| - # TODO(stichnot): -triple=i686-nacl should be used for a
|
| - # sandboxing test. This means there should be an args.sandbox
|
| - # argument that also gets passed through to pnacl-sz.
|
| - '-triple=i686',
|
| - '-filetype=obj', '-o', asm_temp.name]
|
| + cmd += (['|', os.path.join(pnacl_bin_path, 'llvm-mc')] +
|
| + TargetAssemblerFlags(args.target) +
|
| + ['-filetype=obj', '-o', asm_temp.name])
|
| elif asm_temp:
|
| cmd += ['-o', asm_temp.name]
|
| if args.disassemble:
|
| # Show wide instruction encodings, diassemble, and show relocs.
|
| cmd += (['&&', os.path.join(pnacl_bin_path, 'le32-nacl-objdump')] +
|
| args.dis_flags +
|
| - ['-w', '-d', '-r', '-Mintel', asm_temp.name])
|
| + ['-w', '-d', '-r'] + TargetDisassemblerFlags(args.target) +
|
| + [asm_temp.name])
|
|
|
| stdout_result = shellcmd(cmd, echo=args.echo_cmd)
|
| if not args.echo_cmd:
|
|
|