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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 13:22:07 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);
----------------
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


http://reviews.llvm.org/D19419





More information about the llvm-commits mailing list