Fix parsing when one extern follows another.

llvm-svn: 289224
This commit is contained in:
Rafael Espindola 2016-12-09 16:44:05 +00:00
parent 461ba656a5
commit 1ef90d2f25
2 changed files with 18 additions and 1 deletions

View File

@ -1915,9 +1915,11 @@ void ScriptParser::readVersionDeclaration(StringRef VerStr) {
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;

View File

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