From: Rafael Espindola Date: Mon, 22 Aug 2016 21:33:35 +0000 (+0000) Subject: Add support for '|' in expressions. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc3dd629eedb3b5a4f74bf2e0c3729c211d79df7;p=platform%2Fupstream%2Fllvm.git Add support for '|' in expressions. llvm-svn: 279480 --- diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index ed6b39e..c00791d 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -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, Expr R) { 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"); } diff --git a/lld/test/ELF/linkerscript/linkerscript-phdrs-flags.s b/lld/test/ELF/linkerscript/linkerscript-phdrs-flags.s index 1ae500d..d90c042 100644 --- a/lld/test/ELF/linkerscript/linkerscript-phdrs-flags.s +++ b/lld/test/ELF/linkerscript/linkerscript-phdrs-flags.s @@ -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 \