[lld] r273663 - [ELF] - Fix incorrect logic in VersionScriptParser::parseVersion()

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 24 04:23:56 PDT 2016


Author: grimar
Date: Fri Jun 24 06:23:55 2016
New Revision: 273663

URL: http://llvm.org/viewvc/llvm-project?rev=273663&view=rev
Log:
[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

Modified:
    lld/trunk/ELF/SymbolListFile.cpp
    lld/trunk/test/ELF/verdef-dependency.s

Modified: lld/trunk/ELF/SymbolListFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolListFile.cpp?rev=273663&r1=273662&r2=273663&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolListFile.cpp (original)
+++ lld/trunk/ELF/SymbolListFile.cpp Fri Jun 24 06:23:55 2016
@@ -90,7 +90,7 @@ void VersionScriptParser::parseVersion(S
   }
   if (peek() == "local:")
     parseLocal();
-  else
+  else if (peek() != "}")
     parseVersionSymbols(Version);
 
   expect("}");

Modified: lld/trunk/test/ELF/verdef-dependency.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/verdef-dependency.s?rev=273663&r1=273662&r2=273663&view=diff
==============================================================================
--- lld/trunk/test/ELF/verdef-dependency.s (original)
+++ lld/trunk/test/ELF/verdef-dependency.s Fri Jun 24 06:23:55 2016
@@ -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
 




More information about the llvm-commits mailing list