From patchwork Mon Feb 13 13:04:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Matz X-Patchwork-Id: 56279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2331952wrn; Mon, 13 Feb 2023 05:04:25 -0800 (PST) X-Google-Smtp-Source: AK7set+W3kyfv3iMTCPvz6GBGK80wfSgRT002zW56sbqE2Md3vOr26YM17wKF5PvrIi69LIMbgqG X-Received: by 2002:a17:907:1b29:b0:8b1:7fa:ba22 with SMTP id mp41-20020a1709071b2900b008b107faba22mr5912196ejc.27.1676293465609; Mon, 13 Feb 2023 05:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676293465; cv=none; d=google.com; s=arc-20160816; b=cuJLQGgyNbodZvRYyFTdgVLbFZ4t4L9ITM+KcA2ATIRbrpmB0Tf/NumFTc/dz69TKw 6EErOSnubg1weSumZSg7gK6Wckj0mK4uAkjjoFBGT4XwOctYgp9KISY7KBCEzu2VKTM+ 1hyZHGCvCShrPFvDUFLO81Iz95d3TRxm89H9xiNDN+B4zlt93ox9PjLe0gp/VgMxdKh2 ABYpPq0CXDRIrRp8porsBvEjmQo37URcaKFUA4GDOcjFQM4oj86OdTuCyBdiCNC/MGwW vpgvIrooWTr8FBr5HXT/drtXSsDCm/2AjNMIg8L4Ky5JUmtvxbf7mNRN00t0fYKUy+Sv RVHA== 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:mime-version :user-agent:message-id:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=99tBZzqlRhu72UDlTGFTbtHCjF0nhW9ORAxYJ/mrg9w=; b=hgA+T50r1hS9pBOEv3X1l9Cg7SE4YGZmyq7WmwrBvh+u7dBm9eMvchuplXkpbLD30W UzOfB7QWfPCZ6E2lcrZ8kbhvGAhtRIhzYBbGQ5yKmH/Qq3OEvQC1xqrtEcpSckbipqWt oTDiRNJkFn2Ins0+IZCc7RJxeKNMM2d5/wWfRKE3bC1fKAz7Of1gokcHdnyGa43t2cXC gNo4VfkVcz7PCKFBKDzLYvjnxiv6c/dWQEQtfDwStN8oHvJFlkyU3fDGgsds3HPsDss4 5M4rxpIk9sKdIdtBYeQFjc1Yqr4kBGCh3X2jqqrnGD/9mbL6lUL0r4ncdOpdIqzhsrom dcQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="ZQnd/T6I"; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n11-20020a17090673cb00b008b11939bfeasi2335840ejl.743.2023.02.13.05.04.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 05:04:25 -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="ZQnd/T6I"; 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 AE623383FBAE for ; Mon, 13 Feb 2023 13:04:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE623383FBAE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676293464; bh=99tBZzqlRhu72UDlTGFTbtHCjF0nhW9ORAxYJ/mrg9w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ZQnd/T6IJlEBJpiPjhQqtnUNGFfmQs20uBF2o8DkU+4nEDDdWJi2pIH+qF+Yyt6oQ gZ0T8A7XeHdNsuQoHCTCccv/EuBPacLirVrj6Mx9SeVhLlN2DSSe++I7LWu2u2LQXQ InKEQPaplJxtnV7c+RNXm9zzM82qkmJKbR304Ev4= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 2ECD838582AC for ; Mon, 13 Feb 2023 13:04:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2ECD838582AC Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 154F921873 for ; Mon, 13 Feb 2023 13:04:15 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0BD512C141 for ; Mon, 13 Feb 2023 13:04:15 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id 00C8C63B1; Mon, 13 Feb 2023 13:04:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id F33E562DA for ; Mon, 13 Feb 2023 13:04:14 +0000 (UTC) Date: Mon, 13 Feb 2023 13:04:14 +0000 (UTC) To: binutils@sourceware.org Subject: [PATCH, obvious] Fix PR30079: abort on mingw Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: Michael Matz via Binutils From: Michael Matz Reply-To: Michael Matz 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?1757721096473783748?= X-GMAIL-MSGID: =?utf-8?q?1757721096473783748?= the early-out in wild_sort is not enough, it might still be that filenames are equal _and_ the wildcard list doesn't specify a sort order either. Don't call compare_section then. Tested on all targets. --- committed as obvious after convincing myself that I had a thinko here. ld/ldlang.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ld/ldlang.c b/ld/ldlang.c index 84a2914fc26..b5e0d026ae4 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -649,7 +649,8 @@ wild_sort (lang_wild_statement_type *wild, looking at the sections for this file. */ /* Find the correct node to append this section. */ - if (compare_section (sec->spec.sorted, section, (*tree)->section) < 0) + if (sec && sec->spec.sorted != none && sec->spec.sorted != by_none + && compare_section (sec->spec.sorted, section, (*tree)->section) < 0) tree = &((*tree)->left); else tree = &((*tree)->right);