[lld] r289066 - Handle C++ names in anon scripts.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 08:20:30 PST 2016
Author: rafael
Date: Thu Dec 8 10:20:29 2016
New Revision: 289066
URL: http://llvm.org/viewvc/llvm-project?rev=289066&view=rev
Log:
Handle C++ names in anon scripts.
Added:
lld/trunk/test/ELF/version-script-extern-wildcards-anon.s
Modified:
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=289066&r1=289065&r2=289066&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Thu Dec 8 10:20:29 2016
@@ -622,11 +622,11 @@ std::vector<SymbolBody *> SymbolTable<EL
template <class ELFT> void SymbolTable<ELFT>::handleAnonymousVersion() {
for (SymbolVersion &Ver : Config->VersionScriptGlobals) {
if (Ver.HasWildcard) {
- for (SymbolBody *B : findAll(Ver.Name))
+ for (SymbolBody *B : findAll(Ver))
B->symbol()->VersionId = VER_NDX_GLOBAL;
continue;
}
- if (SymbolBody *B = find(Ver.Name))
+ for (SymbolBody *B : find(Ver))
B->symbol()->VersionId = VER_NDX_GLOBAL;
}
}
Added: lld/trunk/test/ELF/version-script-extern-wildcards-anon.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-script-extern-wildcards-anon.s?rev=289066&view=auto
==============================================================================
--- lld/trunk/test/ELF/version-script-extern-wildcards-anon.s (added)
+++ lld/trunk/test/ELF/version-script-extern-wildcards-anon.s Thu Dec 8 10:20:29 2016
@@ -0,0 +1,62 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: echo '{ \
+# RUN: global: \
+# RUN: _Z3bari; \
+# RUN: extern "C++" { \
+# RUN: "foo(int)"; \
+# RUN: z*; \
+# RUN: }; \
+# RUN: local: *; \
+# RUN: }; ' > %t.script
+# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
+# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s
+
+# CHECK: DynamicSymbols [
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name:
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Local
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: _Z3bari
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: _Z3fooi
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: _Z3zedi
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type:
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section:
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+.global _Z3fooi
+_Z3fooi:
+.global _Z3bari
+_Z3bari:
+.global _Z3zedi
+_Z3zedi:
+.global _Z3bazi
+_Z3bazi:
More information about the llvm-commits
mailing list