[lld] r279480 - Add support for '|' in expressions.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 14:33:35 PDT 2016


Author: rafael
Date: Mon Aug 22 16:33:35 2016
New Revision: 279480

URL: http://llvm.org/viewvc/llvm-project?rev=279480&view=rev
Log:
Add support for '|' in expressions.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/test/ELF/linkerscript/linkerscript-phdrs-flags.s

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=279480&r1=279479&r2=279480&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Aug 22 16:33:35 2016
@@ -826,6 +826,7 @@ static int precedence(StringRef Op) {
       .Case("==", 2)
       .Case("!=", 2)
       .Case("&", 1)
+      .Case("|", 1)
       .Default(-1);
 }
 
@@ -1102,6 +1103,8 @@ static Expr combine(StringRef Op, Expr L
     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); };
   llvm_unreachable("invalid operator");
 }
 

Modified: lld/trunk/test/ELF/linkerscript/linkerscript-phdrs-flags.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/linkerscript-phdrs-flags.s?rev=279480&r1=279479&r2=279480&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/linkerscript-phdrs-flags.s (original)
+++ lld/trunk/test/ELF/linkerscript/linkerscript-phdrs-flags.s Mon Aug 22 16:33:35 2016
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (1 + 0x2);} \
+# RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (1 | 1 + 0x1);} \
 # RUN:       SECTIONS { \
 # RUN:           . = 0x10000200; \
 # RUN:           .text : {*(.text*)} :all \




More information about the llvm-commits mailing list