From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 2D77E3858D1E for ; Thu, 13 Jul 2023 16:02:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D77E3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5D18422012; Thu, 13 Jul 2023 16:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689264155; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=428OT7Q5ZyNMIMHYpLu2urZb7KwRMXzUKIr/2aVfaYo=; b=ELDg7el617S8YQJkdJ0nHtE/1AGFok13Vs2QcrBj0RiTUu0aBxjtsU3JwerzCC/DMQ99P9 uyfwkSFev42pcywwA4oM0Wki/YNMb72WkJBUoUujrdv/JPzhiQfz57gJ4Ki3yYuGRaeuBd UObKCrbwNyD+G76o6p9yUX0EV1trRnM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689264155; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=428OT7Q5ZyNMIMHYpLu2urZb7KwRMXzUKIr/2aVfaYo=; b=8iidQbIF7/d8ZXe3NEP6DRy7c2njiBHGBYURo8mAIXu/AuKZh3B1qC3FnuEsMtTj3qddmy ZwCrL5ZwsB0pJSAg== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4E1522C143; Thu, 13 Jul 2023 16:02:35 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id 4164B6924; Thu, 13 Jul 2023 16:02:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id 3FD276733; Thu, 13 Jul 2023 16:02:35 +0000 (UTC) Date: Thu, 13 Jul 2023 16:02:35 +0000 (UTC) From: Michael Matz To: Alan Modra cc: Jan Beulich , binutils@sourceware.org Subject: Re: [PATCH] Let '^' through the lexer In-Reply-To: Message-ID: References: <19b0a86d-1c18-3f3d-3763-74c6ab08c676@suse.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hey, On Thu, 13 Jul 2023, Alan Modra wrote: > On Thu, Jul 13, 2023 at 09:54:46AM +0200, Jan Beulich wrote: > > On 13.07.2023 01:02, Alan Modra via Binutils wrote: > > > This line misses some assignment operators supported by ldgram.y. > > > It should be += -= *= /= <<= >>= &= |= > > > > At which point, considering the subject of the patch, I'm inclined > > to ask: What about ^=? > > It would need support in ldgram.y and ldexp.c. Exactly. I felt that should be a separate patch. But as it's easy to do and improves symmetry, here it is. Okay for master if everything checks out (on x86-64 it does)? Ciao, Michael. -------------- commit 894720ff9ce38ee1758d5a38cd1b0738c524f0c6 Author: Michael Matz Date: Thu Jul 13 17:58:19 2023 +0200 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 5009f0e5a6c..16ed74d7c9b 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 170e1ed7f56..c0d90d3f93a 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(','); }