[all-commits] [llvm/llvm-project] edeeba: [llvm-objcopy] Add support for shell wildcards

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Thu Oct 17 13:49:52 PDT 2019

  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: edeebad7715774b8481103733dc5d52dac43bdf3
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2019-10-17 (Thu, 17 Oct 2019)

  Changed paths:
    M llvm/docs/CommandGuide/llvm-objcopy.rst
    M llvm/docs/CommandGuide/llvm-strip.rst
    A llvm/test/tools/llvm-objcopy/ELF/wildcard-flags.test
    A llvm/test/tools/llvm-objcopy/ELF/wildcard-syntax.test
    M llvm/tools/llvm-objcopy/CommonOpts.td
    M llvm/tools/llvm-objcopy/CopyConfig.cpp
    M llvm/tools/llvm-objcopy/CopyConfig.h
    M llvm/tools/llvm-objcopy/llvm-objcopy.cpp

  Log Message:
  [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

More information about the All-commits mailing list