[PATCH] D40868: [lld] Fix handling of wildcards in dynamic lists.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 16:14:35 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD319860: [lld] Fix handling of wildcards in dynamic lists. (authored by eugenis).

Changed prior to commit:
  https://reviews.llvm.org/D40868?vs=125641&id=125645#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40868

Files:
  ELF/SymbolTable.cpp
  test/ELF/dynamic-list-wildcard.s


Index: ELF/SymbolTable.cpp
===================================================================
--- ELF/SymbolTable.cpp
+++ ELF/SymbolTable.cpp
@@ -685,9 +685,9 @@
   for (SymbolVersion &Ver : Config->DynamicList) {
     std::vector<Symbol *> Syms;
     if (Ver.HasWildcard)
-      Syms = findByVersion(Ver);
-    else
       Syms = findAllByVersion(Ver);
+    else
+      Syms = findByVersion(Ver);
 
     for (Symbol *B : Syms) {
       if (!Config->Shared)
Index: test/ELF/dynamic-list-wildcard.s
===================================================================
--- test/ELF/dynamic-list-wildcard.s
+++ test/ELF/dynamic-list-wildcard.s
@@ -0,0 +1,53 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+# RUN: echo "{ foo1*; };" > %t.list
+# RUN: ld.lld --hash-style=sysv -pie --dynamic-list %t.list %t -o %t.exe
+# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s
+
+# CHECK:      DynamicSymbols [
+# CHECK-NEXT:   Symbol {
+# CHECK-NEXT:     Name:	 @ (0)
+# CHECK-NEXT:     Value:	 0x0
+# CHECK-NEXT:     Size:	 0
+# CHECK-NEXT:     Binding:	 Local (0x0)
+# CHECK-NEXT:     Type:	 None (0x0)
+# CHECK-NEXT:     Other:	 0
+# CHECK-NEXT:     Section:	 Undefined (0x0)
+# CHECK-NEXT:   }
+# CHECK-NEXT:   Symbol {
+# CHECK-NEXT:     Name:	 foo1@ (1)
+# CHECK-NEXT:     Value:	 0x1000
+# CHECK-NEXT:     Size:	 0
+# CHECK-NEXT:     Binding:	 Global (0x1)
+# CHECK-NEXT:     Type:	 None (0x0)
+# CHECK-NEXT:     Other:	 0
+# CHECK-NEXT:     Section:	 .text (0x4)
+# CHECK-NEXT:   }
+# CHECK-NEXT:   Symbol {
+# CHECK-NEXT:     Name:	 foo11@ (6)
+# CHECK-NEXT:     Value:	 0x1001
+# CHECK-NEXT:     Size:	 0
+# CHECK-NEXT:     Binding:	 Global (0x1)
+# CHECK-NEXT:     Type:	 None (0x0)
+# CHECK-NEXT:     Other:	 0
+# CHECK-NEXT:     Section:	 .text (0x4)
+# CHECK-NEXT:   }
+# CHECK-NEXT: ]
+
+.globl foo1
+foo1:
+  ret
+
+.globl foo11
+foo11:
+  ret
+
+.globl foo2
+foo2:
+  ret
+
+.globl _start
+_start:
+  retq


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40868.125645.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/cd22b609/attachment.bin>


More information about the llvm-commits mailing list