[PATCH] D113557: [CMake] Allow passing extra options to extract_symbols.py.

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 05:24:59 PST 2021


simon_tatham added a comment.

Summarising what I said about `argparse` internally:

The `--tools` option to `extract_symbols.py` is defined using `nargs="*"`, which means that you can write multiple argv words after it that will all be treated as operands, e.g. `--tools nm objdump`. In fact, argparse will carry on consuming words from argv until it sees another one that looks like an option.

So if I moved `${LLVM_EXTRACT_SYMBOLS_FLAGS}` in this patch to after the `--mangling` option, the effect would be that if you ran

  cmake -DLLVM_EXTRACT_SYMBOLS_FLAGS="--tools nm objdump"

then the generated command line would look like

  extract_symbols.py --mangling=whatever --tools nm objdump libfoo.a libbar.a -o output-file

and argparse would try to treat `libfoo.a` as an extra argument to `--tools`, and complain that it isn't a legal one!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113557/new/

https://reviews.llvm.org/D113557



More information about the llvm-commits mailing list