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

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 05:57:41 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/LinkerScript.cpp:459
@@ +458,3 @@
+        else if (Cmd->Provision != SymbolProvision::Create)
+          Cmd->Provision = SymbolProvision::Ignore;
+      }
----------------
ruiu wrote:
> This doesn't look beautiful. Isn't there any better way?
I need some flag, so that I don't override value of provided symbol later in assignAddresses, in case it is already defined somewhere. I'll think how to rewrite it, and open to suggestions.

================
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 == ";")
----------------
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


Repository:
  rL LLVM

https://reviews.llvm.org/D22625





More information about the llvm-commits mailing list