[PATCH] D24128: [ELF] PR30221 - linker script expression parser does not accept '~'

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 01:19:15 PDT 2016

grimar added inline comments.

Comment at: ELF/LinkerScript.cpp:1248
@@ +1247,3 @@
+  if (Tok == "~") {
+    Expr E = readParenExpr();
+    return [=](uint64_t Dot) { return ~E(Dot); };
ruiu wrote:
> Even if this is what gold does (I didn't test it myself), this looks very weird. If it's true, it seems a gold's bug. I think any primary expression should be allowed after `~`.
My consern about gold/ld is that users of lld can write some script using our syntax and have a problems if they decide to switch to gold/ld for some reason. I think it is always better to have script files fully compatible if it is possible.
Though it is always more convinent to write ~XXX then ~(XXX), therefore my position here is wonky.



More information about the llvm-commits mailing list