Also support '^=' in linker script expressions
authorMichael Matz <matz@suse.de>
Thu, 13 Jul 2023 15:58:19 +0000 (17:58 +0200)
committerMichael Matz <matz@suse.de>
Mon, 17 Jul 2023 14:59:26 +0000 (16:59 +0200)
this requires also changes in ldgram.y and ldexp.c, unlike
accepting '^' only.  But let's do this anyway, if only for
symmetry.

ld/ld.texi
ld/ldexp.c
ld/ldgram.y
ld/ldlex.l

index 406e87ecad730972f1393dd04a3affad3b4118f7..75e82eda00462f6ceaeea9e4d4a4757609ae93fc 100644 (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}
index 8b9d6dcce0b0c3f9ef5656a43255f9b3442925a9..c53879534a5254a4184d7492587fc0dea6820a43 100644 (file)
@@ -94,6 +94,7 @@ exp_print_token (token_code_type code, int infix_p)
     { RSHIFTEQ, ">>=" },
     { ANDEQ, "&=" },
     { OREQ, "|=" },
+    { XOREQ, "^=" },
     { OROR, "||" },
     { ANDAND, "&&" },
     { EQ, "==" },
index 081176ba0f133658e4dec7c9e7b6a76bba0e90b3..9dbf10b2b1f237e9adb6792f716bbdf26d61c50f 100644 (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
+                       { $$ = '^'; }
 
        ;
 
index 9cb002452d8a94abf2f48d0485bc4376602c280c..435172c08c30269988d37747625a5fdecc338353 100644 (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(','); }