<div dir="ltr">The glob `*` can match zero, one, or many characters. Can you make sure that the test covers those cases?<div><br></div><div>Currently this test only verifies that it matches a single character, and the test would pass if we treated `foo*` as `foo?`.<div><br></div><div>-- Sean Silva</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 8, 2016 at 7:50 AM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Thu Sep 8 09:50:55 2016<br>
New Revision: 280947<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=280947&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=280947&view=rev</a><br>
Log:<br>
Handle globs in global symbol names.<br>
<br>
Fixes pr28775.<br>
<br>
Added:<br>
lld/trunk/test/ELF/version-<wbr>script-glob.s<br>
Modified:<br>
lld/trunk/ELF/SymbolTable.cpp<br>
<br>
Modified: lld/trunk/ELF/SymbolTable.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=280947&r1=280946&r2=280947&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>SymbolTable.cpp?rev=280947&r1=<wbr>280946&r2=280947&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/SymbolTable.cpp (original)<br>
+++ lld/trunk/ELF/SymbolTable.cpp Thu Sep 8 09:50:55 2016<br>
@@ -640,9 +640,21 @@ template <class ELFT> void SymbolTable<E<br>
// in the form of { global: foo; bar; local *; }. So, local is default.<br>
// Here, we make specified symbols global.<br>
if (!Config-><wbr>VersionScriptGlobals.empty()) {<br>
- for (SymbolVersion &Sym : Config->VersionScriptGlobals)<br>
+ std::vector<StringRef> Globs;<br>
+ for (SymbolVersion &Sym : Config->VersionScriptGlobals) {<br>
+ if (hasWildcard(Sym.Name)) {<br>
+ Globs.push_back(Sym.Name);<br>
+ continue;<br>
+ }<br>
if (SymbolBody *B = find(Sym.Name))<br>
B->symbol()->VersionId = VER_NDX_GLOBAL;<br>
+ }<br>
+ if (Globs.empty())<br>
+ return;<br>
+ Regex Re = compileGlobPatterns(Globs);<br>
+ std::vector<SymbolBody *> Syms = findAll(Re);<br>
+ for (SymbolBody *B : Syms)<br>
+ B->symbol()->VersionId = VER_NDX_GLOBAL;<br>
return;<br>
}<br>
<br>
<br>
Added: lld/trunk/test/ELF/version-<wbr>script-glob.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-script-glob.s?rev=280947&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>version-script-glob.s?rev=<wbr>280947&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/version-<wbr>script-glob.s (added)<br>
+++ lld/trunk/test/ELF/version-<wbr>script-glob.s Thu Sep 8 09:50:55 2016<br>
@@ -0,0 +1,45 @@<br>
+# REQUIRES: x86<br>
+<br>
+# RUN: echo "{ global: foo*; bar*; local: *; };" > %t.script<br>
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o<br>
+# RUN: ld.lld -shared --version-script %t.script %t.o -o %t.so<br>
+# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s<br>
+<br>
+ .globl foo1<br>
+foo1:<br>
+<br>
+ .globl bar1<br>
+bar1:<br>
+<br>
+ .globl zed1<br>
+zed1:<br>
+<br>
+# CHECK: DynamicSymbols [<br>
+# CHECK-NEXT: Symbol {<br>
+# CHECK-NEXT: Name:<br>
+# CHECK-NEXT: Value: 0x0<br>
+# CHECK-NEXT: Size: 0<br>
+# CHECK-NEXT: Binding: Local<br>
+# CHECK-NEXT: Type: None<br>
+# CHECK-NEXT: Other: 0<br>
+# CHECK-NEXT: Section: Undefined<br>
+# CHECK-NEXT: }<br>
+# CHECK-NEXT: Symbol {<br>
+# CHECK-NEXT: Name: bar1<br>
+# CHECK-NEXT: Value: 0x1000<br>
+# CHECK-NEXT: Size: 0<br>
+# CHECK-NEXT: Binding: Global<br>
+# CHECK-NEXT: Type: None<br>
+# CHECK-NEXT: Other: 0<br>
+# CHECK-NEXT: Section: .text<br>
+# CHECK-NEXT: }<br>
+# CHECK-NEXT: Symbol {<br>
+# CHECK-NEXT: Name: foo1<br>
+# CHECK-NEXT: Value: 0x1000<br>
+# CHECK-NEXT: Size: 0<br>
+# CHECK-NEXT: Binding: Global<br>
+# CHECK-NEXT: Type: None<br>
+# CHECK-NEXT: Other: 0<br>
+# CHECK-NEXT: Section: .text<br>
+# CHECK-NEXT: }<br>
+# CHECK-NEXT: ]<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>