[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

llvm-svn: 273663
This commit is contained in:
George Rimar 2016-06-24 11:23:55 +00:00
parent 74f56e7de2
commit 6a7cfd039e
2 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ void VersionScriptParser::parseVersion(StringRef Version) {
}
if (peek() == "local:")
parseLocal();
else
else if (peek() != "}")
parseVersionSymbols(Version);
expect("}");

View File

@ -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