[ELF] Fix precedence of ? when there are 2 or more operators on the left hand side
authorFangrui Song <i@maskray.me>
Sat, 25 Jun 2022 20:48:52 +0000 (13:48 -0700)
committerFangrui Song <i@maskray.me>
Sat, 25 Jun 2022 20:48:52 +0000 (13:48 -0700)
commitb0d6dd3905db145853c7c744ac92d49b00b1fa20
treeab06cdf32a501d495ebff0d6c4ecf6715c2b2cdd
parentd479b2e4db62f527e2bcdaa601f9d195cf4b7df0
[ELF] Fix precedence of ? when there are 2 or more operators on the left hand side

For 1 != 1 <= 1 ? 1 : 2, the current code incorrectly considers that ?
has a higher precedence than != (minPrec).

Also, add a test for right associativity.
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/operators.test