[PATCH] D63244: Support wildcard patterns in --undefined.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 00:38:05 PDT 2019


ruiu created this revision.
ruiu added reviewers: peter.smith, grimar, MaskRay.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

This patch makes lld to accept wildcard patterns in `-u` option values.
`-u foo` is to force resolve symbol foo if a foo is not a defined symbol
and there's a static archive that contains a definition of symbol foo.

Now, you can specify a wildcard pattern as an argument for `-u`. So,
if you want to include all JNI symbols (which start with "Java_"), you
can do that by passing `-u "Java_*"` to the linker, for example.

In this patch, I use the same glob pattern matcher as the version script
processor is using, so it does not only support `*` but also `?` and `[...]`.

There's no way to escape metacharacters in `-u` parameter, but I believe
this is OK. In the linker land, neither version script nor linker script
support metacharacter escaping, so not supporting it is actually consistent.

Discussion thread: http://lists.llvm.org/pipermail/llvm-dev/2019-June/132961.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63244

Files:
  lld/ELF/Driver.cpp
  lld/docs/ld.lld.1
  lld/test/ELF/undefined-wildcard.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63244.204439.patch
Type: text/x-patch
Size: 3599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190613/ebc34858/attachment.bin>


More information about the llvm-commits mailing list