public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: binutils@sourceware.org
Subject: [PATCH 8/8] section-select: Fix exclude-file-3
Date: Fri, 25 Nov 2022 16:58:03 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LSU.2.20.2211251657410.24878@wotan.suse.de> (raw)
In-Reply-To: <cover.1669391757.git.matz@suse.de>

this testcase wasn't correctly testing everything, it passed, even
though sections from an excluded file were included.  Fixing this
reveals a problem in the new section selector.  This fixes that as
well.
---
 ld/ldlang.c                                | 7 ++++---
 ld/testsuite/ld-scripts/exclude-file-3.map | 4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ld/ldlang.c b/ld/ldlang.c
index abaa9916256..4e9b93a83a7 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -422,6 +422,10 @@ walk_wild_section_match (lang_wild_statement_type *ptr,
 	return;
     }
 
+  /* If filename is excluded we're done.  */
+  if (walk_wild_file_in_exclude_list (ptr->exclude_name_list, file))
+    return;
+
   /* Check section name against each wildcard spec.  If there's no
      wildcard all sections match.  */
   sec = ptr->section_list;
@@ -920,9 +924,6 @@ resolve_wilds (void)
   LANG_FOR_EACH_INPUT_STATEMENT (f)
     {
       //printf("XXX   %s\n", f->filename);
-      /* XXX if (walk_wild_file_in_exclude_list (s->exclude_name_list, f))
-	return;*/
-
       if (f->the_bfd == NULL
 	  || !bfd_check_format (f->the_bfd, bfd_archive))
 	resolve_wild_sections (f);
diff --git a/ld/testsuite/ld-scripts/exclude-file-3.map b/ld/testsuite/ld-scripts/exclude-file-3.map
index 389d1708c90..255182030ca 100644
--- a/ld/testsuite/ld-scripts/exclude-file-3.map
+++ b/ld/testsuite/ld-scripts/exclude-file-3.map
@@ -3,5 +3,7 @@
  EXCLUDE_FILE\(\*-b\.o\) \*\(\.data \.data\.\*\)
  \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
  \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+#failif
+.*data +0x[0-9a-f]+ +0x[0-9a-f]+ .*exclude-file-b.*
 
-#...
\ No newline at end of file
+#...
-- 
2.36.1

      parent reply	other threads:[~2022-11-25 16:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1669391757.git.matz@suse.de>
2022-11-25 16:44 ` [PATCH 1/8] section-select: Lazily resolve section matches Michael Matz
2022-11-25 16:46 ` [PATCH 2/8] section-select: Deal with sections added late Michael Matz
2022-11-25 16:47 ` [PATCH 3/8] section-select: Implement a prefix-tree Michael Matz
2022-11-25 16:55 ` [PATCH 4/8] section-select: Completely rebuild matches Michael Matz
2022-11-28  1:57   ` Alan Modra
2022-11-28 14:24     ` Michael Matz
2022-11-29 12:22       ` Alan Modra
2022-11-29 13:23         ` Michael Matz
2022-11-25 16:55 ` [PATCH 5/8] section-select: Remove unused code Michael Matz
2022-11-25 16:55 ` [PATCH 6/8] section-select: Cleanup Michael Matz
2022-11-25 16:57 ` [PATCH 7/8] section-select: Remove bfd_max_section_id again Michael Matz
2022-11-25 16:58 ` Michael Matz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.20.2211251657410.24878@wotan.suse.de \
    --to=matz@suse.de \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).