[PATCH] D57517: [llvm-objcopy] Allow using regex in name comparison
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 31 16:40:57 PST 2019
rupprecht added a comment.
In general, I think regex is probably a better choice than wildcards, but I'd be wary of pretending to be GNU compatible with `-w` when it's a different format. Maybe `-r` would be better, or maybe we don't even need a short arg for this. If we're going to implement it as `-w`, I think it would be better to actually be wildcards.
i.e. if someone drops llvm-objcopy into their toolchain and somewhere they use `-w -G foo*`, that means it now only matches things like `fooooooo` but not `foobar` (and additionally will now match `fo` too!)... but it may be a error that takes a while to be exposed. (In general, people assume tools work just fine, and don't always feel the need to write tests).
If we use a different flag, the error will be obvious: it will be "-w is not a valid flag" and exit 1.
Also a question, for others as well: is this a feature we actually want to carry forward? Are there any users of this feature/is it useful? This isn't something I've come across as actually being used, though I'm happy to review it if is.
================
Comment at: tools/llvm-objcopy/CopyConfig.h:100
+ std::vector<NameOrRegex<StringRef>> SymbolsToWeaken;
+ std::vector<NameOrRegex<StringRef>> ToRemove;
+ std::vector<NameOrRegex<std::string>> SymbolsToKeepGlobal;
----------------
Technically, the section flags among these always accept wildcards. `-w` only affects symbol name matching. I'm fine with this though.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57517/new/
https://reviews.llvm.org/D57517
More information about the llvm-commits
mailing list