2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
7 from driver_env import env
8 from driver_log import Log
18 ( '(-.*)', "env.append('FLAGS', $0)"),
19 ( '(.*)', "env.append('INPUTS', pathtools.normalize($0))"),
24 driver_tools.ParseArgs(argv, PATTERNS)
26 inputs = env.get('INPUTS')
29 Log.Fatal("No input files given")
32 driver_tools.CheckPathLength(infile)
34 env.set('input', infile)
36 # For frozen PNaCl bitcode, use 'llvm-nm -bitcode-format=pnacl'. For all
37 # other formats, use the binutils nm with our gold plugin.
38 if filetype.IsPNaClBitcode(infile):
39 env.set('TOOLNAME', '${LLVM_NM}')
40 env.append('FLAGS', '-bitcode-format=pnacl')
42 env.set('TOOLNAME', '${NM}')
43 env.append('FLAGS', '--plugin=${GOLD_PLUGIN_SO}')
45 driver_tools.Run('"${TOOLNAME}" ${FLAGS} ${input}')
48 # only reached in case of no errors
51 def get_help(unused_argv):
53 Usage: %s [option(s)] [file(s)]
54 List symbols in [file(s)].
56 * For stable PNaCl bitcode files, this calls the llvm-nm tool.
57 * For all other files, this calls the standard nm from binutils - please see
58 that tool's help pages for options.
59 """ % env.getone('SCRIPT_NAME')