From patchwork Wed Mar 1 04:00:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 62752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3414794wrd; Tue, 28 Feb 2023 20:00:17 -0800 (PST) X-Google-Smtp-Source: AK7set9Ith23HQHkLyP3gBr7YANOuxC3+9kIh3vvWvVivB3lEfg1ksLiM117vQ63YhBCDcb73B8B X-Received: by 2002:a05:6402:58:b0:4b0:87ec:2b98 with SMTP id f24-20020a056402005800b004b087ec2b98mr5505168edu.16.1677643216971; Tue, 28 Feb 2023 20:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677643216; cv=none; d=google.com; s=arc-20160816; b=vQqyUSMaNyw9WqWfXGLLpgsT4G/BX4q1YDLs/u/t9fQSUM4vfvj9gOJcmSC+QAUI1G I/H+1jWPwy2geGZ2Y4vNDu/glbfEHUq2DGh+KMNLI5LoKwRoiUt81FigHs2BHsSkGff7 i+y6K7kKFkFwDBrLCA1I8Pw4UNUP7rshbFfopVd7ypDzK5AAu6E970MmZ5iSw3YqR962 2RKWVk8b9t6TWacN0TVdZ3eP+lnoGjrZ476+cLJmlQa+ApMX2YxClGELC4HWN9rP9IvP B4fwrfQ6Aq5XFPVGGJm33XsVdjHHfMsbg18bMMf44ef7OmNIQ1z3EVacYITPbvkA+ixb Gk0g== 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-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=LWwWI9eE9758RNUI1P0ZsTRrZlZOIn2/3etRXeR8z0w=; b=sN+zFwyIHuAf++9Fy/YcuaAN4G1ZedeLgXBnFFDK3UBFksveNmZ4hCeuLxacp8l5yM eTR6F90o+a5FYOYE9Ums/juzuXnOwP3CyNCVnFuGrY5fazO4nVr8LzyZcOu6uukzXpq0 cHn04N1Wx6ZHFUsjRm4fDisVmrp4/YH1yzF4IcUyGpw1uHtf1+OzRAs0K5a4blthJhAP OhtSmFpzQ5YgJWUNl1k8PFfzkdr2IKIjCtpshMB9nKJ8+VHdoVpuXgUAAqSq2DD279Tl kTAbvGPFManLyUG6Vs8YBtQu3GTMV7GGvNE6SDvBhTL7ifXVditXbbARRYQ5WO3LCHK9 GrBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mwV0iglQ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y2-20020aa7ccc2000000b004acc76c1cf4si2213185edt.563.2023.02.28.20.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 20:00:16 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mwV0iglQ; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 0397D3858401 for ; Wed, 1 Mar 2023 04:00:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0397D3858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677643215; bh=LWwWI9eE9758RNUI1P0ZsTRrZlZOIn2/3etRXeR8z0w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=mwV0iglQD7pgFM5mb9xrc9QQM/pcY/dmxyyHpiTXZXRWMawAVWEge6R6FHWI9oldO 9e8fmIr55Fq2tVW8uwW5UhM8ME6RmgNepCtdn2eCMQ0q5F7Wks6Ct01ONgdwUDVFYv VqbRiJ59zZSBca7Rpp9n2TROuCaD8HMAEjK7OqsQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id C8ED1385841A for ; Wed, 1 Mar 2023 04:00:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8ED1385841A Received: by mail-pl1-x62b.google.com with SMTP id u5so9276637plq.7 for ; Tue, 28 Feb 2023 20:00:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677643206; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LWwWI9eE9758RNUI1P0ZsTRrZlZOIn2/3etRXeR8z0w=; b=iotLjkm2+ZNbe8mI/Vi6qiMHdwZoyVfXwhPj7rGxjYnQdh224S35SNS02RV+G88/yo Stx8OW1qvGd30XPnR5uH+2RCI6T14oLcRSiLS+7kHtLamyzS7rvq7wKbwgbMlkFwLHXH 81nMGGAnJ0SxHXf9116Pq3GvvqC1hqqWT0+7NcKdJ2kN1caM81LR/TQxrGDynRqyAm/p BY39/X/N3LiVdzCJTOEaJZixWI1CIMqfNndtptGdMYpOL8i6xLr5nAgW9pWdsRGUFuum Xhctqb9Md93nN4v29AZ4ZkdiIZNKbqwKLUUtSWoYdN8djUJetlXMagiDE6stKXVIqWdk Fmrw== X-Gm-Message-State: AO0yUKUD+pzMdQ+mscMmCtmSt9req8GPyVrGm7kooxGmwIwXZe4aLY7P /XaQ6+tkvQjBGNHMNRKFG24ZhjM1ji8= X-Received: by 2002:a17:902:b082:b0:19d:1674:c04d with SMTP id p2-20020a170902b08200b0019d1674c04dmr4796924plr.61.1677643205743; Tue, 28 Feb 2023 20:00:05 -0800 (PST) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id jc11-20020a17090325cb00b0019682e27995sm7309549plb.223.2023.02.28.20.00.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 20:00:05 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 586291142D9B; Wed, 1 Mar 2023 14:30:03 +1030 (ACDT) Date: Wed, 1 Mar 2023 14:30:03 +1030 To: binutils@sourceware.org Subject: gas s_fill caused internal error in frag_new Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3035.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra 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?1759136414070445629?= X-GMAIL-MSGID: =?utf-8?q?1759136414070445629?= Fix an internal error after "non-constant fill count for absolute section". * read.c (s_fill): Don't create frags after errors. 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) {