[lld] r289224 - Fix parsing when one extern follows another.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 08:44:05 PST 2016


Author: rafael
Date: Fri Dec  9 10:44:05 2016
New Revision: 289224

URL: http://llvm.org/viewvc/llvm-project?rev=289224&view=rev
Log:
Fix parsing when one extern follows another.

Added:
    lld/trunk/test/ELF/dynamic-list-extern.s
Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=289224&r1=289223&r2=289224&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Fri Dec  9 10:44:05 2016
@@ -1915,9 +1915,11 @@ void ScriptParser::readVersionDeclaratio
 std::vector<SymbolVersion> ScriptParser::readSymbols() {
   std::vector<SymbolVersion> Ret;
   for (;;) {
-    if (consume("extern"))
+    if (consume("extern")) {
       for (SymbolVersion V : readVersionExtern())
         Ret.push_back(V);
+      continue;
+    }
 
     if (peek() == "}" || peek() == "local:" || Error)
       break;

Added: lld/trunk/test/ELF/dynamic-list-extern.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-list-extern.s?rev=289224&view=auto
==============================================================================
--- lld/trunk/test/ELF/dynamic-list-extern.s (added)
+++ lld/trunk/test/ELF/dynamic-list-extern.s Fri Dec  9 10:44:05 2016
@@ -0,0 +1,15 @@
+# REQUIRES: x86
+
+# Test that we can parse multiple externs.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+
+# RUN: echo '{ \
+# RUN:         extern "C" { \
+# RUN:           foo; \
+# RUN:         }; \
+# RUN:         extern "C++" { \
+# RUN:           bar; \
+# RUN:         }; \
+# RUN:       };' > %t.list
+# RUN: ld.lld --dynamic-list %t.list %t.o -shared -o %t.so




More information about the llvm-commits mailing list