From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1677794673; bh=0UEJPx+cOwjCVTq089fsqcbt3E5yCr9OkJ9cOsTFjKw=; h=From:To:Subject; b=24fKSJzPiJfZ9lyuJHtxjHvieNEtPGm2RwOvJZABF1vZrdA+TCvjAoHk4mMNCQ/TT t0HWIzsQKVl+j6EWMKqDwFBpVdFiHy9d+Mv5YkiocSaoWufyJezrjrgE+zbJSDu6it oIvg6KjdWzIngP3oPs6VKVrW6Fu0ERSbt/gpxIiU= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=valinor.ownit.se Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) From: binutils@emagii.com 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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) { -- 2.34.1