[PATCH] D24860: [ELF] - Linkerscript: Implemented >> and <<
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 06:22:45 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282243: [ELF] - Linkerscript: Implemented >> and << (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D24860?vs=72261&id=72263#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24860
Files:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/locationcounter.s
Index: lld/trunk/test/ELF/linkerscript/locationcounter.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/locationcounter.s
+++ lld/trunk/test/ELF/linkerscript/locationcounter.s
@@ -42,6 +42,11 @@
# RUN: .plusassign : { *(.plusassign) } \
# RUN: . = ((. + 0x1fff) & ~(0x1000 + -1)); \
# RUN: .unary : { *(.unary) } \
+# RUN: . = 0x30000 + (1 + 1 << 5); \
+# RUN: .shiftl : { *(.shiftl) } \
+# RUN: . = 0x30000 + (1 + 1023 >> 2); \
+# RUN: .shiftr : { *(.shiftr) } \
+
# RUN: }" > %t.script
# RUN: ld.lld %t --script %t.script -o %t2
# RUN: llvm-objdump -section-headers %t2 | FileCheck %s
@@ -65,6 +70,8 @@
# CHECK: .datasegmentalign {{.*}} 0000000000200000
# CHECK: .plusassign {{.*}} 0000000000028000
# CHECK: .unary {{.*}} 000000000002a000
+# CHECK: .shiftl {{.*}} 0000000000030040
+# CHECK: .shiftr {{.*}} 0000000000030100
## Mailformed number error.
# RUN: echo "SECTIONS { \
@@ -174,3 +181,9 @@
.section .unary, "a"
.quad 0
+
+.section .shiftl, "a"
+.quad 0
+
+.section .shiftr, "a"
+.quad 0
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -1081,10 +1081,12 @@
static int precedence(StringRef Op) {
return StringSwitch<int>(Op)
- .Case("*", 4)
- .Case("/", 4)
- .Case("+", 3)
- .Case("-", 3)
+ .Case("*", 5)
+ .Case("/", 5)
+ .Case("+", 4)
+ .Case("-", 4)
+ .Case("<<", 3)
+ .Case(">>", 3)
.Case("<", 2)
.Case(">", 2)
.Case(">=", 2)
@@ -1361,6 +1363,10 @@
return [=](uint64_t Dot) { return L(Dot) + R(Dot); };
if (Op == "-")
return [=](uint64_t Dot) { return L(Dot) - R(Dot); };
+ if (Op == "<<")
+ return [=](uint64_t Dot) { return L(Dot) << R(Dot); };
+ if (Op == ">>")
+ return [=](uint64_t Dot) { return L(Dot) >> R(Dot); };
if (Op == "<")
return [=](uint64_t Dot) { return L(Dot) < R(Dot); };
if (Op == ">")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24860.72263.patch
Type: text/x-patch
Size: 2075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160923/1438efaf/attachment.bin>
More information about the llvm-commits
mailing list