aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-06-24 11:23:55 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-06-24 11:23:55 +0000
commita4a46a5a246af643fcd58d9c83a2c0b55ddb6f27 (patch)
tree9719a35cc97e2efcdc162b328794bab51ec381d1
parent75a1b9762a16df998cd5df4d9d7bc24e85433f41 (diff)
[ELF] - Fix incorrect logic in VersionScriptParser::parseVersion()
Previously the next sample script would generate 2 entries in Config->SymbolVersions with the same version name. VERSION { global: c; }; That happened because parseVersionSymbols() was called twice. At first for "global:" and since there is no local tag, it was called again. Patch fixes the issue, testcase was updated to demonstrate. Differential revision: http://reviews.llvm.org/D21640 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@273663 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--ELF/SymbolListFile.cpp2
-rw-r--r--test/ELF/verdef-dependency.s2
2 files changed, 2 insertions, 2 deletions
diff --git a/ELF/SymbolListFile.cpp b/ELF/SymbolListFile.cpp
index 4855f5780..fccfd28df 100644
--- a/ELF/SymbolListFile.cpp
+++ b/ELF/SymbolListFile.cpp
@@ -90,7 +90,7 @@ void VersionScriptParser::parseVersion(StringRef Version) {
}
if (peek() == "local:")
parseLocal();
- else
+ else if (peek() != "}")
parseVersionSymbols(Version);
expect("}");
diff --git a/test/ELF/verdef-dependency.s b/test/ELF/verdef-dependency.s
index 180881804..c40ce3fca 100644
--- a/test/ELF/verdef-dependency.s
+++ b/test/ELF/verdef-dependency.s
@@ -8,7 +8,7 @@
# RUN: local: *; }LIBSAMPLE_1.0; \
# RUN: LIBSAMPLE_3.0{ \
# RUN: global: c; \
-# RUN: local: *; }LIBSAMPLE_2.0;" > %t.script
+# RUN: }LIBSAMPLE_2.0;" > %t.script
# RUN: ld.lld --version-script %t.script -shared -soname shared %t.o -o %t.so
# RUN: llvm-readobj -V -dyn-symbols %t.so | FileCheck --check-prefix=DSO %s