Also support '^=' in linker script expressions

this requires also changes in ldgram.y and ldexp.c, unlike
accepting '^' only.  But let's do this anyway, if only for
symmetry.
This commit is contained in:
Michael Matz 2023-07-13 17:58:19 +02:00
parent b26b06dd42
commit c684d6c4e3
4 changed files with 7 additions and 3 deletions

View file

@ -6832,7 +6832,7 @@ precedence associativity Operators Notes
10 left &&
11 left ||
12 right ? :
13 right += -= *= /= <<= >>= &= |= (2)
13 right += -= *= /= <<= >>= &= |= ^= (2)
(lowest)
@end smallexample
Notes:
@ -6866,7 +6866,7 @@ height2pt&\omit&&\omit&&\omit&\cr
&10&&left&&{\&\&}&\cr
&11&&left&&||&\cr
&12&&right&&? :&\cr
&13&&right&&\qquad += -= *= /= <<= >>= \&= |=\qquad\ddag&\cr
&13&&right&&\qquad += -= *= /= <<= >>= \&= |= \^{}=\qquad\ddag&\cr
&lowest&&&&&\cr
height2pt&\omit&&\omit&&\omit&\cr}
\hrule}

View file

@ -94,6 +94,7 @@ exp_print_token (token_code_type code, int infix_p)
{ RSHIFTEQ, ">>=" },
{ ANDEQ, "&=" },
{ OREQ, "|=" },
{ XOREQ, "^=" },
{ OROR, "||" },
{ ANDAND, "&&" },
{ EQ, "==" },

View file

@ -108,7 +108,7 @@ static int error_index;
%type <section_phdr> phdr_opt
%type <integer> opt_nocrossrefs
%right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
%right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ XOREQ
%right <token> '?' ':'
%left <token> OROR
%left <token> ANDAND
@ -747,6 +747,8 @@ assign_op:
{ $$ = '&'; }
| OREQ
{ $$ = '|'; }
| XOREQ
{ $$ = '^'; }
;

View file

@ -233,6 +233,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<SCRIPT,EXPRESSION,MRI,WILD>"/=" { RTOKEN(DIVEQ); }
<SCRIPT,EXPRESSION,MRI,WILD>"&=" { RTOKEN(ANDEQ); }
<SCRIPT,EXPRESSION,MRI,WILD>"|=" { RTOKEN(OREQ); }
<SCRIPT,EXPRESSION,MRI,WILD>"^=" { RTOKEN(XOREQ); }
<EXPRESSION,MRI>"&&" { RTOKEN(ANDAND); }
<SCRIPT,EXPRESSION,MRI>">" { RTOKEN('>'); }
<SCRIPT,EXPRESSION,MRI,INPUTLIST>"," { RTOKEN(','); }