[PATCH] D21732: [ELF] Initial support for wildcard in symbol versions

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 25 23:14:24 PDT 2016


davide created this revision.
davide added reviewers: grimar, rafael, ruiu.
davide added a subscriber: llvm-commits.

```
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.

http://reviews.llvm.org/D21732

Files:
  ELF/SymbolTable.cpp
  ELF/SymbolTable.h
  test/ELF/partial-version.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21732.61901.patch
Type: text/x-patch
Size: 3217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160626/513b2d53/attachment.bin>


More information about the llvm-commits mailing list