From patchwork Thu Mar 2 22:04:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Frager, Neal via Binutils" X-Patchwork-Id: 63599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp92488wrd; Thu, 2 Mar 2023 14:05:32 -0800 (PST) X-Google-Smtp-Source: AK7set/hb7LpGPPFXG4MMMd73WCRV5HCWffdEJN1IesM8mzbziVZaN6VCWr+Kc3h8VpZ09NyRZ9L X-Received: by 2002:aa7:d68f:0:b0:4c0:57b:47a9 with SMTP id d15-20020aa7d68f000000b004c0057b47a9mr4081723edr.35.1677794732056; Thu, 02 Mar 2023 14:05:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677794732; cv=none; d=google.com; s=arc-20160816; b=xcs+qOKk37uH5DQZ2DKyeFzpHjcoQbCAyw7CspypiKVhR6TCHEL/9lVrH41JNtQ+mR eAtniPwHyB0LXfzRDN0/FgeyZLIbF24BHxf/gDSaSu98lPhZ3Gsxi8rrNAcm8L7fqlDi 5nFJWludJQiWLBKtbeiGZH9FjwFc7UJY9rrAcBxyW30RKxARXqyRqMk5+vbsIiiYqKNk r3+C9DUFWdNKvLqxitGqi9MwjZHSAeI0pfB+KW5o32QX3DnXbR1KLLWs5UVoHW1mq+bf y5kHQYw3ppE5ZhSy3VfURZZWBj7dfYhlsJd+qmnASw/vIcj6aFDAu5BJ3bdmk0JKCS/N lNMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=0UEJPx+cOwjCVTq089fsqcbt3E5yCr9OkJ9cOsTFjKw=; b=UAvjuZyZDmdDcBEvDKi1UmlEa1iqFUc4/+A6/qOlMrGFz8dVkytXEHMI4dqdCuRv8Q ecSHNIJJAH0PrLmZAZtI03YnXoWeI1X4KfKUlOBS+mVdkdthhxkGFDUjrXGpxqVOI2QK un2FbYI1RW+ETZzDs55VaIOOgHoqv5KQlsatrGk88dFfTI4famqy4bJSjbkEgAnCEYep RBrVAMQllAK83GLm7l4I6a6QBqMuKDi65gB2tPd9dkrfpIxFG/18+tU2zuZjmIB/Dfn2 3gTWZD9ru8cLyxME/L653ro45hc0MouVyrqx4Ne34Q3fYRLy1On+Wpu7kkhojxT5u+jf G+Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fgUrL5Yl; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ba7-20020a0564021ac700b004a0a7d851f5si711587edb.634.2023.03.02.14.05.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 14:05:32 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fgUrL5Yl; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 979D23850224 for ; Thu, 2 Mar 2023 22:04:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 979D23850224 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677794696; bh=0UEJPx+cOwjCVTq089fsqcbt3E5yCr9OkJ9cOsTFjKw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=fgUrL5YlJq/s6YYcrR0jyDsXq+TKefdeccI2ejqs38d5QaDpcBBEfQqqF49asMwfV O+KzgtAfxUa9SG0PpqXHuZpXv/HbCZYlFFza6Is7v2KH/POWVABi7QI5rRTrJ7HY9P qpcvo9FxTjVw0Y4T00aGCgPciwTvGED1BJm7u5Po= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 75966385B53E for ; Thu, 2 Mar 2023 22:04:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 75966385B53E Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 417521201F3; Thu, 2 Mar 2023 23:04:33 +0100 (CET) Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) To: binutils@sourceware.org Cc: nickc@redhat.com, Alan Modra Subject: [PATCH v9 07/11] gas s_fill caused internal error in frag_new Date: Thu, 2 Mar 2023 23:04:04 +0100 Message-Id: <20230302220408.1925678-8-binutils@emagii.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302220408.1925678-1-binutils@emagii.com> References: <20230302220408.1925678-1-binutils@emagii.com> MIME-Version: 1.0 X-PPP-Message-ID: <167779467351.1167733.7043154958185137929@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_FAIL, 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-Patchwork-Original-From: Ulf Samuelsson via Binutils From: "Frager, Neal via Binutils" Reply-To: binutils@emagii.com Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759295289194459170?= X-GMAIL-MSGID: =?utf-8?q?1759295289194459170?= From: Alan Modra Fix an internal error after "non-constant fill count for absolute section". * read.c (s_fill): Don't create frags after errors. --- gas/read.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/gas/read.c b/gas/read.c index d43584be28c..5d83d35e0aa 100644 --- a/gas/read.c +++ b/gas/read.c @@ -2201,22 +2201,32 @@ s_fill (int ignore ATTRIBUTE_UNUSED) as_warn (_("repeat < 0; .fill ignored")); size = 0; } - - if (size && !need_pass_2) + else if (size && !need_pass_2) { - if (now_seg == absolute_section) + if (now_seg == absolute_section && rep_exp.X_op != O_constant) { - if (rep_exp.X_op != O_constant) - as_bad (_("non-constant fill count for absolute section")); - else if (fill && rep_exp.X_add_number != 0) - as_bad (_("attempt to fill absolute section with non-zero value")); - abs_section_offset += rep_exp.X_add_number * size; + as_bad (_("non-constant fill count for absolute section")); + size = 0; + } + else if (now_seg == absolute_section && fill && rep_exp.X_add_number != 0) + { + as_bad (_("attempt to fill absolute section with non-zero value")); + size = 0; } else if (fill && (rep_exp.X_op != O_constant || rep_exp.X_add_number != 0) && in_bss ()) - as_bad (_("attempt to fill section `%s' with non-zero value"), - segment_name (now_seg)); + { + as_bad (_("attempt to fill section `%s' with non-zero value"), + segment_name (now_seg)); + size = 0; + } + } + + if (size && !need_pass_2) + { + if (now_seg == absolute_section) + abs_section_offset += rep_exp.X_add_number * size; if (rep_exp.X_op == O_constant) {