From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 12B703858C2F for ; Sat, 16 Jul 2022 02:02:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 12B703858C2F Received: by mail-pg1-x52e.google.com with SMTP id r186so5900337pgr.2 for ; Fri, 15 Jul 2022 19:02:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jDE4E7S+mn5oWHffFkxc2x74xtqKfXlhTmbYazPbDgg=; b=6nTDDsLCFjAJeD0D9IfEepSRGWW+bQYttjrOgtWxkI+C4Wj2pDxwIcBcFMFpDMDyiX Ne7jS4W9XH8lyC+uIDlNNQzo5kU+y0oXLtD9UcELehrJoXhj+8MOgo9PxUWVrD65ihFj pfA43DBNg7NgKRpyyR0TjW463xiZ09j6sygNoHjZRY5fnmVOm4wsC2NXkZtz/KxvDHud WFnwmXi+R113KbWKmLv/0LcJBlP2UPjV+P5bivrj+HsYR6VRc6xWneLT96uT2Jged+ES cBP5sT/7Ud9dBkzw71KWLymHvabCHolDwNYpJALTg6pWrOr6RrLTrMbaN6iRLd4Dxg3f oPxQ== X-Gm-Message-State: AJIora9GEvs+ssU5/3t0EheOnwsIBz/AVl78ukmg4DZU4DmoUHnwJFpg 2AuosO7tYTsjlkDFfqZ7Yg1JVJhQUfs= X-Google-Smtp-Source: AGRyM1vpnUHSIo+ELxdrRZxzrGO41NBN8CkS8PoQ5GhAwah7y9K+fSSpB1v/x/vJcdMxKYvCZMEh7w== X-Received: by 2002:a65:49c5:0:b0:412:6e3e:bd91 with SMTP id t5-20020a6549c5000000b004126e3ebd91mr14870316pgs.221.1657936948935; Fri, 15 Jul 2022 19:02:28 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:812c:bb5b:991c:b094]) by smtp.gmail.com with ESMTPSA id qe10-20020a17090b4f8a00b001ecd954f3b6sm6390482pjb.7.2022.07.15.19.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 19:02:27 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 02A0B1140488; Sat, 16 Jul 2022 11:32:25 +0930 (ACST) Date: Sat, 16 Jul 2022 11:32:24 +0930 From: Alan Modra To: Dmitry Selyutin Cc: Binutils , Luke Kenneth Casson Leighton Subject: Re: [PATCH] gas/symbols: do not panic upon resolving O_md Message-ID: References: <20220714212651.297902-1-ghostmansd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3028.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2022 02:02:31 -0000 On Fri, Jul 15, 2022 at 08:13:01AM +0300, Dmitry Selyutin wrote: > On Fri, Jul 15, 2022, 07:50 Alan Modra wrote: > > > On Fri, Jul 15, 2022 at 12:26:52AM +0300, Dmitry Selyutin wrote: > > > + case O_md1...O_md32: > > > > Please don't use gcc extensions. > > > > My initial impression was that the code uses them (e.g. ATTRIBUTE_UNUSED). > But OK, actually the first thing I did was a simple "if" in the default > section; I only thought that ranges would be more evident. Alternatively, > we could have a bunch of O_md cases; 32 cases with just a simple break > might be way too much, though. With md_resolve_symbol this makes more > sense, I think. > > > This might avoid the fatal error, but will still hit an error later > > due to resolved not being set. > > > I assume you mean symbol->flags.resolving = 0, right? If so, this is set > after the switch (including this break). No, I mean what I said. if (resolved) symp->flags.resolved = 1; else if (S_GET_SEGMENT (symp) != expr_section) { as_bad (_("can't resolve value for symbol `%s'"), S_GET_NAME (symp)); symp->flags.resolved = 1; } > I think this calls for an > > md_resolve_symbol. > > > > Do you mean letting the caller define this as macro? I suggest calling it > in "default:" section then, with the corresponding ifdef check. -- Alan Modra Australia Development Lab, IBM