<html><head></head><body>Replace 1 with 0+1 so that we test the precedence.<br>
<br>
LGTM with that.<br><br><div class="gmail_quote">On September 23, 2016 8:45:52 AM EDT, George Rimar <grimar@accesssoftek.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">grimar created this revision.<br />grimar added reviewers: ruiu, rafael.<br />grimar added subscribers: llvm-commits, grimar, evgeny777.<br /><br />Found this operators used in the wild here:<br /><a href="https://searchcode.com/file/103745382/board/bf561-ezkit/u-boot.lds.S">https://searchcode.com/file/103745382/board/bf561-ezkit/u-boot.lds.S</a><br /><br />```<br /> __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;<br /> __fixup_entries = (. - _FIXUP_TABLE_)>>2;<br />```<br /><br /><a href="https://reviews.llvm.org/D24860">https://reviews.llvm.org/D24860</a><br /><br />Files:<br /> ELF/LinkerScript.cpp<br /> test/ELF/linkerscript/locationcounter.s<br /><br />Index: test/ELF/linkerscript/locationcounter.s<br /><hr /><br />--- test/ELF/linkerscript/locationcounter.s<br />+++ test/ELF/linkerscript/locationcounter.s<br />@@ -42,6 +42,11 @@<br /> # RUN: .plusassign : { *(.plusassign) } \<br /> # RUN: . = ((. + 0x1fff) & ~(0x1000 + -1)); \<br
/> # RUN: .unary : { *(.unary) } \<br />+# RUN: . = 0x30000 + (1 << 5); \<br />+# RUN: .shiftl : { *(.shiftl) } \<br />+# RUN: . = 0x30000 + (1024 >> 2); \<br />+# RUN: .shiftr : { *(.shiftr) } \<br />+<br /> # RUN: }" > %t.script<br /> # RUN: ld.lld %t --script %t.script -o %t2<br /> # RUN: llvm-objdump -section-headers %t2 | FileCheck %s<br />@@ -65,6 +70,8 @@<br /> # CHECK: .datasegmentalign {{.*}} 0000000000200000<br /> # CHECK: .plusassign {{.*}} 0000000000028000<br /> # CHECK: .unary {{.*}} 000000000002a000<br />+# CHECK: .shiftl {{.*}} 0000000000030020<br />+# CHECK: .shiftr {{.*}} 0000000000030100<br /> <br /> ## Mailformed number error.<br /> # RUN: echo "SECTIONS { \<br />@@ -174,3 +181,9 @@<br /> <br /> .section .unary, "a"<br /> .quad 0<br />+<br />+.section .shiftl, "a"<br />+.quad 0<br />+<br />+.section .shiftr, "a"<br />+.quad 0<br />Index: ELF/LinkerScript.cpp<br /><hr /><br />--- ELF/LinkerScript.cpp<br
/>+++ ELF/LinkerScript.cpp<br />@@ -1081,10 +1081,12 @@<br /> <br /> static int precedence(StringRef Op) {<br /> return StringSwitch<int>(Op)<br />- .Case("*", 4)<br />- .Case("/", 4)<br />- .Case("+", 3)<br />- .Case("-", 3)<br />+ .Case("*", 5)<br />+ .Case("/", 5)<br />+ .Case("+", 4)<br />+ .Case("-", 4)<br />+ .Case("<<", 3)<br />+ .Case(">>", 3)<br /> .Case("<", 2)<br /> .Case(">", 2)<br /> .Case(">=", 2)<br />@@ -1361,6 +1363,10 @@<br /> return [=](uint64_t Dot) { return L(Dot) + R(Dot); };<br /> if (Op == "-")<br /> return [=](uint64_t Dot) { return L(Dot) - R(Dot); };<br />+ if (Op == "<<")<br />+ return [=](uint64_t Dot) { return L(Dot) << R(Dot); };<br />+ if (Op == ">>")<br />+ return [=](uint64_t Dot) { return L(Dot) >> R(Dot); };<br /> if (Op == "<")<br /> return [=](uint64_t Dot) { return L(Dot) < R(Dot); };<br /> if
(Op == ">")<br /><br /><br /></pre></blockquote></div><br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>