VERSION_1.0 { global: foo*; local: *; }
currently doesn't add any symbol to the dynamic symbol table because the code has no logic for wildcard(s).
This patch is an attempt to fix, only for the "easy" case when the wildcard matching is at the end of the word.
The patch is motivated by an example I found in the wild. In fact, libreoffice has a version script which looks like this:
PRIVATE_textenc.1 { # LibreOffice 3.6 global: _ZN3sal6detail7textenc20convertCharToUnicode*; _ZN3sal6detail7textenc20convertUnicodeToChar*; _ZN3sal6detail7textenc32handleUndefinedUnicodeToTextChar*; _ZN3sal6detail7textenc37handleBadInputTextToUnicodeConversion*; _ZN3sal6detail7textenc37handleBadInputUnicodeToTextConversion*; };
This patch implements the matching in the most naive way possible, i.e. through a linear scan of the symbol table for each requested matching. It could be probably improved switching symtab to a data structure that preserves ordering of elements, but that will slow down the common case, so I'm not entirely sure it's worth it.
Comments welcome.
This should be defined in lld::elf namespace.