[PATCH] D19419: [ELF] - Implemented comparsion operators for linkerscript

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 13:59:41 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:51-61
@@ -50,7 +50,13 @@
   return StringSwitch<int>(Op)
-      .Case("*", 4)
-      .Case("/", 3)
-      .Case("+", 2)
-      .Case("-", 2)
-      .Case("&", 1)
+      .Case("*", 6)
+      .Case("/", 5)
+      .Case("+", 4)
+      .Case("-", 3)
+      .Case("&", 2)
+      .Case("<", 1)
+      .Case(">", 1)
+      .Case(">=", 1)
+      .Case("<=", 1)
+      .Case("==", 0)
+      .Case("!=", 0)
       .Default(-1);
----------------
ruiu wrote:
> These operator precedences are not correct. * and / should have the same precedence, and so are + and -. & has lower precedence over comparison operators.
> 
> https://www.sourceware.org/binutils/docs-2.10/ld_3.html#SEC45
Also, please don't use precedence 0. We pass 0 as the minimum precedence in parseExpr. It doesn't expect that there is an operator with precedence 0.


http://reviews.llvm.org/D19419





More information about the llvm-commits mailing list