[PATCH] D64130: [LLD][ELF] - Linkerscript: add a support for expressions for section's filling

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 22:30:06 PDT 2019


MaskRay added a comment.

Looks good to me.



================
Comment at: ELF/ScriptLexer.cpp:195
+    // Get the operator as a token.
+    // Keep !=, ==, >=, <=, << and >> operators as a single tokens.
+    if (S.substr(E).startswith("!=") || S.substr(E).startswith("==") ||
----------------
arichardson wrote:
> This seems unrelated, maybe split it out into a separate patch?
I think tokenizeExpr() did not have to be precise before because readOutputSectionDescription() did not consume tokens that can be prefixed of ==, <<, <=, >= and >> (i.e. =, <, >). Now it did so a preciser tokenizeExpr is needed.

I think keeping the change here is probably fine.


================
Comment at: test/ELF/linkerscript/sections-padding.s:45
+## Check we can use an artbitrary expression as a filler.
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } = ((0x11 << 8) | 0x22) }" > %t.script
+# RUN: ld.lld -o %t.out --script %t.script %t
----------------
You can delete the spaces around `<<` to check tokens are correctly split.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64130/new/

https://reviews.llvm.org/D64130





More information about the llvm-commits mailing list