[PATCH] D42820: Relax the grammar of the version script.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 15:48:17 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD324036: Relax the grammar of the version script. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42820?vs=132482&id=132498#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42820

Files:
  ELF/ScriptParser.cpp
  test/ELF/dynamic-list-extern.s


Index: test/ELF/dynamic-list-extern.s
===================================================================
--- test/ELF/dynamic-list-extern.s
+++ test/ELF/dynamic-list-extern.s
@@ -4,12 +4,8 @@
 
 # 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: echo '{ extern "C" { foo; }; extern "C++" { bar; }; };' > %t.list
+# RUN: ld.lld --dynamic-list %t.list %t.o -shared -o %t.so
+
+# RUN: echo '{ extern "C" { foo }; extern "C++" { bar }; };' > %t.list
 # RUN: ld.lld --dynamic-list %t.list %t.o -shared -o %t.so
Index: ELF/ScriptParser.cpp
===================================================================
--- ELF/ScriptParser.cpp
+++ ELF/ScriptParser.cpp
@@ -1233,6 +1233,9 @@
 
 // Reads an "extern C++" directive, e.g.,
 // "extern "C++" { ns::*; "f(int, double)"; };"
+//
+// The last semicolon is optional. E.g. this is OK:
+// "extern "C++" { ns::*; "f(int, double)" };"
 std::vector<SymbolVersion> ScriptParser::readVersionExtern() {
   StringRef Tok = next();
   bool IsCXX = Tok == "\"C++\"";
@@ -1245,6 +1248,8 @@
     StringRef Tok = next();
     bool HasWildcard = !Tok.startswith("\"") && hasWildcard(Tok);
     Ret.push_back({unquote(Tok), IsCXX, HasWildcard});
+    if (consume("}"))
+      return Ret;
     expect(";");
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42820.132498.patch
Type: text/x-patch
Size: 1465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/785ee93b/attachment.bin>


More information about the llvm-commits mailing list