Message ID | alpine.LSU.2.20.2306261532320.13548@wotan.suse.de |
---|---|
State | Unresolved |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7568681vqr; Mon, 26 Jun 2023 08:35:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5eI0jVgJiaHwEML5M0+e2BJuQGzZHtikEt2RTByP96aNDPM6emK3aoLFhaZsNk7+/cFvEf X-Received: by 2002:a2e:2e07:0:b0:2b6:a5a4:188c with SMTP id u7-20020a2e2e07000000b002b6a5a4188cmr1197567lju.45.1687793724323; Mon, 26 Jun 2023 08:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687793724; cv=none; d=google.com; s=arc-20160816; b=V7aou249nNX6vDB2musd7yG+S2m8XW1mOIs0WttKmTzHcu/ycUBHS3YC6jZcOyvV88 aAmuAqsJisrzfUKnH9Bqyf/LtLTfsBzrcE89TSJY6/AtD+CtCOy3+N0/gYcXREgBZPBE dEyGs64416Pp6rYEjf4EYXDOBfFwP3YjDzrBzc00pSTmiyNreN1PsUoltlPvLWyshnzr Mwn5xPtLUK3Qk+mywQCfd4PPLUiv3jHb9pBkuAHGkusyY4/mZNEP1omYEjSTl73NInvo lVxmcw8k6N+EoNdiPe0iWhxJFlOtK9VloLykIW3csfWGoP0nmvtPOyUBlA7EmaaT41sS BnSw== 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=hWs/Ve0zaddZX7i9X/e4i7rgw1NrO82n7fI2AfZa4hM=; fh=NLxAvL/bDfPg4AGOtxqvQlND8vazkZrNzKLY8+LAbBY=; b=fuqyeOw+9LpHiMuOUWQrefoXw7uWzEMOYNOaaVx1lEB/V4J84f0zvSf//uB7/vB7ww 3AUFdnpV7WFSUBaDh7yoktO3JKpmvOgSZNaPnZkm2V0JG+4aqfEc57xbS0TBA2ZO1zMd ZNjLG7hH/X+bP+zp5MahVT3kqz2Tq+3d5HMA02fuHSO0fCG9/RTbwwUUZLM9jFNngVsZ v+RICBX3F9XFaXFQG3uudbM5eqm3ksFUT+N6wpGRX8t+K+QJb/Es1+4wYvRb1pMFjlTR tqcQG7Zf02Wz4pT4Pg3Xa0vcWH6KhV7y26AbHxSw0WqeUlodBku9q8B4z6sL8uHdKo38 OH3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lip1XnsP; 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 i17-20020a1709064ed100b009745bad4249si3014255ejv.869.2023.06.26.08.35.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 08:35:24 -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=lip1XnsP; 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 3DEDC3858418 for <ouuuleilei@gmail.com>; Mon, 26 Jun 2023 15:35:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DEDC3858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687793718; bh=hWs/Ve0zaddZX7i9X/e4i7rgw1NrO82n7fI2AfZa4hM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lip1XnsPlVTdDxAeGU4G3fbMeAxWNp5Uat8nnZ0xBcMcULSeOq38LmMw9wToQ/lrF bNtTGktjcSLc5fRVQZI8EP8FklSOR47TB5P+NWIPYF+Q48wzDH4tmbLbVVSqPrBwkU yOpjki/lhlVlSk2DndpIV1skXeqm6caJjI+z+v+g= 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 EF9073858418 for <binutils@sourceware.org>; Mon, 26 Jun 2023 15:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF9073858418 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2C6A121855 for <binutils@sourceware.org>; Mon, 26 Jun 2023 15:35:09 +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 216112C141 for <binutils@sourceware.org>; Mon, 26 Jun 2023 15:35:09 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id 1849367ED; Mon, 26 Jun 2023 15:35:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id 175F065E2 for <binutils@sourceware.org>; Mon, 26 Jun 2023 15:35:09 +0000 (UTC) Date: Mon, 26 Jun 2023 15:35:09 +0000 (UTC) To: binutils@sourceware.org Subject: [PATCH] section-match: Check parent archive name as well Message-ID: <alpine.LSU.2.20.2306261532320.13548@wotan.suse.de> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-9.1 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, 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 <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Michael Matz via Binutils <binutils@sourceware.org> Reply-To: Michael Matz <matz@suse.de> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769779991967486934?= X-GMAIL-MSGID: =?utf-8?q?1769779991967486934?= |
Series |
section-match: Check parent archive name as well
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | warning | Git am fail log |
Commit Message
Michael Matz
June 26, 2023, 3:35 p.m. UTC
rewriting the section matching routines lost a special case of matching: section statements of the form NAME(section-glob) normally match against NAME being an object file, but like in the exclude list we happened to accept archive names as NAME (undocumented). The documented way to specify (all) archive members is by using e.g. lib.a:(section-glob) (that does work also with the prefix tree matcher). But I intended to not actually change behaviour with the prefix tree implementation. So, let's also implement checking against archive names with a similar FIXME comment we already have in walk_wild_file_in_exclude_list. --- Regtesting on Alans targets in progress, on x86_64-linux it finished already successfully. Okay for master? --- ld/ldlang.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
Comments
Lame self-reply:
On Mon, 26 Jun 2023, Michael Matz via Binutils wrote:
> Regtesting on Alans targets in progress,
that finished uneventful as well.
Ciao,
Michael.
Hi Michael, > rewriting the section matching routines lost a special case > of matching: section statements of the form > > NAME(section-glob) > > normally match against NAME being an object file, but like in > the exclude list we happened to accept archive names as NAME > (undocumented). The documented way to specify (all) archive members > is by using e.g. > > lib.a:(section-glob) > > (that does work also with the prefix tree matcher). > > But I intended to not actually change behaviour with the prefix > tree implementation. So, let's also implement checking against > archive names with a similar FIXME comment we already have in > walk_wild_file_in_exclude_list. Looks good, but please could also update the documentation so that this use is explicitly cited as being supported ? Also would you mind adding a link to your post to this list to the PR 30590 so that anyone reading that bug report can see how you fixed it. Thanks https://sourceware.org/bugzilla/show_bug.cgi?id=30590 Cheers Nick
Hello Nick, On Tue, 27 Jun 2023, Nick Clifton wrote: > > NAME(section-glob) > > > > normally match against NAME being an object file, but like in > > the exclude list we happened to accept archive names as NAME > > (undocumented). The documented way to specify (all) archive members > > is by using e.g. > > > > lib.a:(section-glob) > > > > (that does work also with the prefix tree matcher). > > > > But I intended to not actually change behaviour with the prefix > > tree implementation. So, let's also implement checking against > > archive names with a similar FIXME comment we already have in > > walk_wild_file_in_exclude_list. > > Looks good, but please could also update the documentation so that > this use is explicitly cited as being supported ? Actually, I'm reluctant to do that and would like to keep this undocumented. We wouldn't be able to fix the FIXMEs in walk_wild_file_in_exclude_list anymore if such usage was documented, and we have a different (documented) way to specify what the user wanted. In either case that should be a separate and conscious patch as it would introduce (formally) new behaviour. If you still want me to amend the patch with a documentation change, I will, but only on second request ;-) > Also would you mind adding a link to your post to this list to > the PR 30590 so that anyone reading that bug report can see how > you fixed it. Thanks > > https://sourceware.org/bugzilla/show_bug.cgi?id=30590 Oh yes, I haven't yet seen that a bugzilla entry was created for that. The commit will have it. Ciao, Michael.
Hi Michael, >> Looks good, but please could also update the documentation so that >> this use is explicitly cited as being supported ? > > Actually, I'm reluctant to do that and would like to keep this > undocumented. We wouldn't be able to fix the FIXMEs in > walk_wild_file_in_exclude_list anymore if such usage was documented, and > we have a different (documented) way to specify what the user wanted. > > In either case that should be a separate and conscious patch as it > would introduce (formally) new behaviour. If you still want me to amend > the patch with a documentation change, I will, but only on second request > ;-) Fair enough. >> Also would you mind adding a link to your post to this list to >> the PR 30590 so that anyone reading that bug report can see how >> you fixed it. Thanks >> >> https://sourceware.org/bugzilla/show_bug.cgi?id=30590 > > Oh yes, I haven't yet seen that a bugzilla entry was created for that. > The commit will have it. Great - patch approved - please apply. Cheers Nick PS. A patch to add a test for this bug to the linker testsuite is pre-approved, should you feel like writing one ....
diff --git a/ld/ldlang.c b/ld/ldlang.c index 78716f17729..e359a89fcc0 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -445,8 +445,19 @@ walk_wild_section_match (lang_wild_statement_type *ptr, about unset local_sym_name (in which case lookup_name simply adds the input file again). */ const char *filename = file->local_sym_name; - if (filename == NULL - || filename_cmp (filename, file_spec) != 0) + lang_input_statement_type *arch_is; + if (filename && filename_cmp (filename, file_spec) == 0) + ; + /* FIXME: see also walk_wild_file_in_exclude_list for why we + also check parents BFD (local_sym_)name to match input statements + with unadorned archive names. */ + else if (file->the_bfd + && file->the_bfd->my_archive + && (arch_is = bfd_usrdata (file->the_bfd->my_archive)) + && arch_is->local_sym_name + && filename_cmp (arch_is->local_sym_name, file_spec) == 0) + ; + else return; }