aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2023-07-13 17:58:19 +0200
committerMichael Matz <matz@suse.de>2023-07-17 16:59:26 +0200
commitc684d6c4e3cd299f7e10576eafe9e4b86521e3d0 (patch)
tree1d3cc7b6a70f5bf8262bda9a2a48c062f034d50e /ld
parentb26b06dd42fbd9a75eebb4c943bf55a88562b81f (diff)
downloadgdb-c684d6c4e3cd299f7e10576eafe9e4b86521e3d0.zip
gdb-c684d6c4e3cd299f7e10576eafe9e4b86521e3d0.tar.gz
gdb-c684d6c4e3cd299f7e10576eafe9e4b86521e3d0.tar.bz2
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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ld.texi4
-rw-r--r--ld/ldexp.c1
-rw-r--r--ld/ldgram.y4
-rw-r--r--ld/ldlex.l1
4 files changed, 7 insertions, 3 deletions
diff --git a/ld/ld.texi b/ld/ld.texi
index 406e87e..75e82ed 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 8b9d6dc..c538795 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 081176b..9dbf10b 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -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
+ { $$ = '^'; }
;
diff --git a/ld/ldlex.l b/ld/ldlex.l
index 9cb0024..435172c 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -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(','); }