OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # IMPORTANT NOTE: If you make local mods to this file, you must run: | 6 # IMPORTANT NOTE: If you make local mods to this file, you must run: |
7 # % pnacl/build.sh driver | 7 # % pnacl/build.sh driver |
8 # in order for them to take effect in the scons build. This command | 8 # in order for them to take effect in the scons build. This command |
9 # updates the copy in the toolchain/ tree. | 9 # updates the copy in the toolchain/ tree. |
10 # | 10 # |
11 | 11 |
12 import driver_env | 12 from driver_env import env |
13 import driver_tools | 13 import driver_tools |
14 import pathtools | |
14 | 15 |
15 EXTRA_ENV = { | 16 EXTRA_ENV = { |
16 'ARGS' : '', | 17 'ARGS' : '', |
17 } | 18 } |
18 | 19 |
19 PATTERNS = [ | 20 PATTERNS = [ |
20 ('(.*)', "env.append('ARGS', $0)"), | 21 ('(.*)', "env.append('ARGS', $0)"), |
21 ] | 22 ] |
22 | 23 |
23 def main(argv): | 24 def main(argv): |
24 driver_env.env.update(EXTRA_ENV) | 25 env.update(EXTRA_ENV) |
25 driver_tools.ParseArgs(argv, PATTERNS) | 26 driver_tools.ParseArgs(argv, PATTERNS) |
26 | 27 |
28 args = env.get('ARGS') | |
29 input = pathtools.normalize(args[-1]) | |
jvoung (off chromium)
2013/07/10 00:18:29
Maybe do a sanity check the len of the args array
| |
30 if driver_tools.IsPNaClBitcode(input): | |
31 env.append('ARGS', '--bitcode-format=pnacl') | |
27 driver_tools.Run('"${PNACL_ABICHECK}" ${ARGS}') | 32 driver_tools.Run('"${PNACL_ABICHECK}" ${ARGS}') |
28 return 0; | 33 return 0; |
29 | 34 |
30 # Don't just call the binary with -help because most of those options are | 35 # Don't just call the binary with -help because most of those options are |
31 # completely useless for this tool. | 36 # completely useless for this tool. |
32 def get_help(unused_argv): | 37 def get_help(unused_argv): |
33 return """ | 38 return """ |
34 USAGE: pnacl-abicheck <input bitcode> | 39 USAGE: pnacl-abicheck <input bitcode> |
35 If <input bitcode> is -, then standard input will be read. | 40 If <input bitcode> is -, then standard input will be read. |
36 """ | 41 """ |
OLD | NEW |