[PATCH] D22625: [ELF] Support PROVIDE and PROVIDE_HIDDEN within SECTIONS {} block

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 05:58:48 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:799-807
@@ -778,5 +798,11 @@
 std::vector<StringRef> ScriptParser::readSectionsCommandExpr() {
+  int Braces = 0;
   std::vector<StringRef> Expr;
   while (!Error) {
-    StringRef Tok = next();
+    StringRef Tok = peek();
+    Braces += (Tok == "(");
+    Braces -= (Tok == ")");
+    if (Braces < 0)
+      break;
+    next();
     if (Tok == ";")
----------------
evgeny777 wrote:
> ruiu wrote:
> > Is this change related to the feature you are adding in this patch?
> Yes. As I said in summary, this is intended to early terminate the expression reader in case we see extra ')' bracket. Otherwise parser will eat tokens till it finds semicolon
This should be fixed in separate patch.

================
Comment at: test/ELF/linkerscript-symbols.s:43
@@ +42,2 @@
+.global somesym
+somesym=0
----------------
somesym = 0
(just hard to read)


Repository:
  rL LLVM

https://reviews.llvm.org/D22625





More information about the llvm-commits mailing list