[lld] r274071 - Handle empty versions.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 28 14:48:33 PDT 2016
Author: rafael
Date: Tue Jun 28 16:48:33 2016
New Revision: 274071
URL: http://llvm.org/viewvc/llvm-project?rev=274071&view=rev
Log:
Handle empty versions.
They are significant now that we support @ in symbol names.
Added:
lld/trunk/test/ELF/Inputs/empty-ver.ver
lld/trunk/test/ELF/empty-ver.s
Modified:
lld/trunk/ELF/SymbolListFile.cpp
Modified: lld/trunk/ELF/SymbolListFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolListFile.cpp?rev=274071&r1=274070&r2=274071&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolListFile.cpp (original)
+++ lld/trunk/ELF/SymbolListFile.cpp Tue Jun 28 16:48:33 2016
@@ -84,6 +84,7 @@ private:
void VersionScriptParser::parseVersion(StringRef Version) {
expect("{");
+ Config->SymbolVersions.push_back(elf::Version(Version));
if (peek() == "global:") {
next();
parseVersionSymbols(Version);
@@ -108,12 +109,10 @@ void VersionScriptParser::parseLocal() {
void VersionScriptParser::parseVersionSymbols(StringRef Version) {
std::vector<StringRef> *Globals;
- if (Version.empty()) {
+ if (Version.empty())
Globals = &Config->VersionScriptGlobals;
- } else {
- Config->SymbolVersions.push_back(elf::Version(Version));
+ else
Globals = &Config->SymbolVersions.back().Globals;
- }
for (;;) {
StringRef Cur = peek();
Added: lld/trunk/test/ELF/Inputs/empty-ver.ver
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/empty-ver.ver?rev=274071&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/empty-ver.ver (added)
+++ lld/trunk/test/ELF/Inputs/empty-ver.ver Tue Jun 28 16:48:33 2016
@@ -0,0 +1,2 @@
+ver {
+};
Added: lld/trunk/test/ELF/empty-ver.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/empty-ver.s?rev=274071&view=auto
==============================================================================
--- lld/trunk/test/ELF/empty-ver.s (added)
+++ lld/trunk/test/ELF/empty-ver.s Tue Jun 28 16:48:33 2016
@@ -0,0 +1,25 @@
+// REQUIRES: x86
+// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
+// RUN: ld.lld %t.o -o %t.so -shared -version-script %p/Inputs/empty-ver.ver
+// RUN: llvm-readobj -version-info %t.so | FileCheck %s
+
+// CHECK: Version symbols {
+// CHECK-NEXT: Section Name:
+// CHECK-NEXT: Address:
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: Link:
+// CHECK-NEXT: Symbols [
+// CHECK-NEXT: Symbol {
+// CHECK-NEXT: Version: 0
+// CHECK-NEXT: Name: @
+// CHECK-NEXT: }
+// CHECK-NEXT: Symbol {
+// CHECK-NEXT: Version: 2
+// CHECK-NEXT: Name: foo at ver
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
+// CHECK-NEXT: }
+
+
+.global foo at ver
+foo at ver:
More information about the llvm-commits
mailing list