From: Michael Matz Date: Thu, 13 Jul 2023 15:58:19 +0000 (+0200) Subject: Also support '^=' in linker script expressions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c684d6c4e3cd299f7e10576eafe9e4b86521e3d0;p=binutils-gdb.git 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. --- diff --git a/ld/ld.texi b/ld/ld.texi index 406e87ecad7..75e82eda004 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -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} diff --git a/ld/ldexp.c b/ld/ldexp.c index 8b9d6dcce0b..c53879534a5 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -94,6 +94,7 @@ exp_print_token (token_code_type code, int infix_p) { RSHIFTEQ, ">>=" }, { ANDEQ, "&=" }, { OREQ, "|=" }, + { XOREQ, "^=" }, { OROR, "||" }, { ANDAND, "&&" }, { EQ, "==" }, diff --git a/ld/ldgram.y b/ld/ldgram.y index 081176ba0f1..9dbf10b2b1f 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -108,7 +108,7 @@ static int error_index; %type phdr_opt %type opt_nocrossrefs -%right PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ +%right PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ XOREQ %right '?' ':' %left OROR %left ANDAND @@ -747,6 +747,8 @@ assign_op: { $$ = '&'; } | OREQ { $$ = '|'; } + | XOREQ + { $$ = '^'; } ; diff --git a/ld/ldlex.l b/ld/ldlex.l index 9cb002452d8..435172c08c3 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -233,6 +233,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* "/=" { RTOKEN(DIVEQ); } "&=" { RTOKEN(ANDEQ); } "|=" { RTOKEN(OREQ); } +"^=" { RTOKEN(XOREQ); } "&&" { RTOKEN(ANDAND); } ">" { RTOKEN('>'); } "," { RTOKEN(','); }