[PATCH] D36451: [ELF, LinkerScript] Support ! operator in linker script.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 06:02:29 PDT 2017


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: ELF/ScriptLexer.cpp:193-197
+    size_t OpSize = 1;
+    if (S.size() > (E + 1) && S[E] == '!' && S[E+1] == '=')
+      OpSize = 2;
+    Ret.push_back(S.substr(E, OpSize));
+    S = S.substr(E + OpSize);
----------------
This is probably a bit more straightforward:

  if (S.substr(E).startswith("!=")) {
    Ret.push_back(S.substr(E, 2));
    S = S.substr(E + 2);
  } else {
    Ret.push_back(S.substr(E, 1));
    S = S.substr(E + 1);
  }


================
Comment at: test/ELF/linkerscript/symbol-assignexpr.s:20
+# RUN:         symbol14 = !0; \
+# RUN:         symbol15 = 0!=1; \
 # RUN:         bar = 0x5678; \
----------------
Thank you for adding this test.


https://reviews.llvm.org/D36451





More information about the llvm-commits mailing list