Fix parsing when one extern follows another.

llvm-svn: 289224
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index d5e9487..bf19914 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1915,9 +1915,11 @@
 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;
diff --git a/lld/test/ELF/dynamic-list-extern.s b/lld/test/ELF/dynamic-list-extern.s
new file mode 100644
index 0000000..dfeb31d
--- /dev/null
+++ b/lld/test/ELF/dynamic-list-extern.s
@@ -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