summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-03-15 23:12:33 +0000
committerRui Ueyama <ruiu@google.com>2018-03-15 23:12:33 +0000
commitaa92fca83c7681a502546258bf6590ec0789914f (patch)
treee770840172abdd93850bd43aaeb22ac475249a3a /lld/ELF/ScriptParser.cpp
parent1b8cf49704150d0617158dda6eec0ccba8e80423 (diff)
downloadbcm5719-llvm-aa92fca83c7681a502546258bf6590ec0789914f.tar.gz
bcm5719-llvm-aa92fca83c7681a502546258bf6590ec0789914f.zip
Fix linker script operator precedence.
"&" should have higher priority than "|" [1]. Previously, they had the same priority. [1] https://sourceware.org/binutils/docs/ld/Operators.html Differential Revision: https://reviews.llvm.org/D43880 llvm-svn: 327684
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 26c88a91422..6f16c45baab 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -469,11 +469,12 @@ void ScriptParser::readSections() {
static int precedence(StringRef Op) {
return StringSwitch<int>(Op)
- .Cases("*", "/", "%", 5)
- .Cases("+", "-", 4)
- .Cases("<<", ">>", 3)
- .Cases("<", "<=", ">", ">=", "==", "!=", 2)
- .Cases("&", "|", 1)
+ .Cases("*", "/", "%", 6)
+ .Cases("+", "-", 5)
+ .Cases("<<", ">>", 4)
+ .Cases("<", "<=", ">", ">=", "==", "!=", 3)
+ .Case("&", 2)
+ .Case("|", 1)
.Default(-1);
}
OpenPOWER on IntegriCloud