diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2019-10-17 20:51:00 +0000 |
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2019-10-17 20:51:00 +0000 |
| commit | edeebad7715774b8481103733dc5d52dac43bdf3 (patch) | |
| tree | c84c0c304f7142e3ecef79ccd5120179a6dc1e60 /llvm/docs/CommandGuide | |
| parent | 9c5d76ff4d15e2cabf976911bd150302ae5fdeea (diff) | |
| download | bcm5719-llvm-edeebad7715774b8481103733dc5d52dac43bdf3.tar.gz bcm5719-llvm-edeebad7715774b8481103733dc5d52dac43bdf3.zip | |
[llvm-objcopy] Add support for shell wildcards
Summary: GNU objcopy accepts the --wildcard flag to allow wildcard matching on symbol-related flags. (Note: it's implicitly true for section flags).
The basic syntax is to allow *, ?, \, and [] which work similarly to how they work in a shell. Additionally, starting a wildcard with ! causes that wildcard to prevent it from matching a flag.
Use an updated GlobPattern in libSupport to handle these patterns. It does not fully match the `fnmatch` used by GNU objcopy since named character classes (e.g. `[[:digit:]]`) are not supported, but this should support most existing use cases (mostly just `*` is what's used anyway).
Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap
Reviewed By: MaskRay
Subscribers: nickdesaulniers, emaste, arichardson, hiraditya, jakehehrlich, abrachet, seiya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66613
llvm-svn: 375169
Diffstat (limited to 'llvm/docs/CommandGuide')
| -rw-r--r-- | llvm/docs/CommandGuide/llvm-objcopy.rst | 24 | ||||
| -rw-r--r-- | llvm/docs/CommandGuide/llvm-strip.rst | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/llvm/docs/CommandGuide/llvm-objcopy.rst b/llvm/docs/CommandGuide/llvm-objcopy.rst index ccdcf13eb59..56c3a77716b 100644 --- a/llvm/docs/CommandGuide/llvm-objcopy.rst +++ b/llvm/docs/CommandGuide/llvm-objcopy.rst @@ -142,6 +142,30 @@ multiple file formats. Read command-line options and commands from response file `<FILE>`. +.. option:: --wildcard, -w + + Allow wildcard syntax for symbol-related flags. On by default for + section-related flags. Incompatible with --regex. + + Wildcard syntax allows the following special symbols: + + ====================== ========================= ================== + Character Meaning Equivalent + ====================== ========================= ================== + ``*`` Any number of characters ``.*`` + ``?`` Any single character ``.`` + ``\`` Escape the next character ``\`` + ``[a-z]`` Character class ``[a-z]`` + ``[!a-z]``, ``[^a-z]`` Negated character class ``[^a-z]`` + ====================== ========================= ================== + + Additionally, starting a wildcard with '!' will prevent a match, even if + another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols + except for ``x``. + + The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is + the same as ``-w -N '!x' -N '*'``. + COFF-SPECIFIC OPTIONS --------------------- diff --git a/llvm/docs/CommandGuide/llvm-strip.rst b/llvm/docs/CommandGuide/llvm-strip.rst index 41529bf08cc..e1f07d9a76f 100644 --- a/llvm/docs/CommandGuide/llvm-strip.rst +++ b/llvm/docs/CommandGuide/llvm-strip.rst @@ -104,6 +104,30 @@ multiple file formats. Read command-line options and commands from response file `<FILE>`. +.. option:: --wildcard, -w + + Allow wildcard syntax for symbol-related flags. On by default for + section-related flags. Incompatible with --regex. + + Wildcard syntax allows the following special symbols: + + ====================== ========================= ================== + Character Meaning Equivalent + ====================== ========================= ================== + ``*`` Any number of characters ``.*`` + ``?`` Any single character ``.`` + ``\`` Escape the next character ``\`` + ``[a-z]`` Character class ``[a-z]`` + ``[!a-z]``, ``[^a-z]`` Negated character class ``[^a-z]`` + ====================== ========================= ================== + + Additionally, starting a wildcard with '!' will prevent a match, even if + another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols + except for ``x``. + + The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is + the same as ``-w -N '!x' -N '*'``. + COFF-SPECIFIC OPTIONS --------------------- |

