From patchwork Sat May 13 11:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 93505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5705776vqo; Sat, 13 May 2023 04:18:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qSu+1Tvrd6R3XtLik19JQfEcfY1r/axfq9ZW5kf09tUTZz8fit0ZEoBWoqet/zTJoR4HR X-Received: by 2002:a17:907:60d6:b0:957:1df0:9cbf with SMTP id hv22-20020a17090760d600b009571df09cbfmr28564834ejc.19.1683976694409; Sat, 13 May 2023 04:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683976694; cv=none; d=google.com; s=arc-20160816; b=w4jEEtxyeD/XP/oN+gN3ZJc0srznFWAAQbGNdEnOd9zu/LA5JCZCyty7diQa5pygZq SVfZaIB1e54C7tNfpfggaqCFb8bMjxMKjWVvkAYSMimAEz6AzcJ6z4YeXDKOwM4bF99b tQCNOHFT7bekfqTXrG+DQ3pTFkhXcopy+LRcPQbJ4NLAgRtPzjTxZrEJjACeGKLTspgH 6QTauxkcOk2S7JdbjArKMnLA44YhsFo+3G9XF6UwSKyI+vZMot7ukAtcz1ECKM4Yrx/N G0FNgaA2lLx6vd4PqEOh0DrRQH2xA8njxkV24clSAhV+jJ7WfxgMXV0xwPrlwSeB8IHl QXHA== 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=vczQrpJWIiRHoBtq9M8IT1kgqQv/mUs3IA403tTyFF0=; b=c+Js3jWVKM8QrsC7CsZrWPAF6SB6Ob/eP185nAzTVUQzIqKo+PbuwRXKqOrZXnZNOt fCEmY0SeZ//Aowg/14zkM8LK4RzR3QV7HvvtA6XfXryJYqpj7ZqKU/Uqo+pEDNt/Z1Gg U56Ytdh2QNKAxR5u7FG7XtM3aDihEmc8v7+hKJvpezuYBgeCLxHHRsd/DuTRc7Fo7ziF JIXSWqr0s3cU9B4xYF2jaXxBnMVj8iYRXt875zcM7B/bRTPwWIoO9c7aEP63O+GQ0OWh iH2htOU48FGXYIQwvY/gCp2C/pZrEA/OloTYMz54vOeFYeokVO8YGG7zsZ2gRlT1KfGH u7+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fu2GzfLQ; 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 rq7-20020a17090788c700b0096a0d763894si4897555ejc.1050.2023.05.13.04.18.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 04:18:14 -0700 (PDT) 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=fu2GzfLQ; 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 4B4E73858414 for ; Sat, 13 May 2023 11:18:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B4E73858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683976693; bh=vczQrpJWIiRHoBtq9M8IT1kgqQv/mUs3IA403tTyFF0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fu2GzfLQ9t4N/pgiR9nUXj8l0TGoOIbDD9NtjhIFqx04oad+JglO++wvn+C11oA4W y6YVYdOu6Gcy3JDXFJ+QTeiHuIpThH3q28UByBkvlvm8PBE/h+So+N/FDcxUMKQdF9 JrCKlVmNTrXtfN8eneOCTWOw8kSOuD8rssTrexyo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 8D7EC3858C52 for ; Sat, 13 May 2023 11:18:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D7EC3858C52 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-52cbd7d0c37so6052088a12.3 for ; Sat, 13 May 2023 04:18:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683976684; x=1686568684; 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=vczQrpJWIiRHoBtq9M8IT1kgqQv/mUs3IA403tTyFF0=; b=AtbnYtE6vN8CHiMu7Ml9TmjcyqNuZdVH5sS68K6OV9RTtCFNBEfAH6KD8xy0Si3uod gsV/FSg4nZtHRjlv24ngIrtNNIjMjJrsmpxCh4yLVrx6GLYpOEqylH+5EOc+4PEXgkuP Owes+6yQ8z0gx7dGPtSq/cT8+TlYvDuDbDQnStvCMDRK6Bg1zLHj16Wmg884irzMpdD4 ZRnQ4sJSg+YWTJ4YbvOlSBPIXqHOXPPC9DvxqKOd6r1+L5duNVnvVGMpsjMaqb7yf06f TQAVo8hyG3v5OJIm928zLgfPhmdWGOw4dLo1VO2BocWHfeia6mUdfwXRyyeSkCK4PKRV EA2g== X-Gm-Message-State: AC+VfDzST0cYn5iCoDrpk/9IAXaunIcbqNHJnKnew6t9RRwO+LqU+I+N zKetwSss8txG2SMZ/Dx4PpokXzb9EQA= X-Received: by 2002:a17:90a:290e:b0:23c:fef0:d441 with SMTP id g14-20020a17090a290e00b0023cfef0d441mr28570730pjd.33.1683976684042; Sat, 13 May 2023 04:18:04 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:314f:3514:134d:47b3]) by smtp.gmail.com with ESMTPSA id t11-20020a17090b018b00b0024de39e8746sm18507568pjs.11.2023.05.13.04.18.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 04:18:03 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 3B2361142F55; Sat, 13 May 2023 20:48:01 +0930 (ACST) Date: Sat, 13 May 2023 20:48:01 +0930 To: binutils@sourceware.org Subject: PR28955 mips gas segfault Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.3 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, 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 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?1765777546495304966?= X-GMAIL-MSGID: =?utf-8?q?1765777546495304966?= I'm going to commit this as obvious enough to not ask for target maintainer approval. Testing for NULL in pic_need_relax fixes the other call to this function in md_estimate_size_before_relax. PR 28955 * config/tc-mips.c (mips_frob_file): Move NULL sym test to.. (pic_need_relax): ..here. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 8a970ceada2..55a116ffd90 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -15449,8 +15449,7 @@ mips_frob_file (void) there isn't supposed to be a matching LO. Ignore %gots against constants; we'll report an error for those later. */ if (got16_reloc_p (l->fixp->fx_r_type) - && !(l->fixp->fx_addsy - && pic_need_relax (l->fixp->fx_addsy))) + && !pic_need_relax (l->fixp->fx_addsy)) continue; /* Check quickly whether the next fixup happens to be a matching %lo. */ @@ -17705,6 +17704,9 @@ pic_need_relax (symbolS *sym) { asection *symsec; + if (!sym) + return false; + /* Handle the case of a symbol equated to another symbol. */ while (symbol_equated_reloc_p (sym)) {