[binutils-gdb] section-select: Fix exclude-file-3

Michael Matz matz@sourceware.org
Wed Nov 30 16:16:04 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=885d86436c3f9ab0a13f39647860b526faa92cf8

commit 885d86436c3f9ab0a13f39647860b526faa92cf8
Author: Michael Matz <matz@suse.de>
Date:   Wed Nov 16 16:28:01 2022 +0100

    section-select: Fix exclude-file-3
    
    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.

Diff:
---
 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 2dfc42099ed..d873adb8d9c 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
+#...


More information about the Binutils-cvs mailing list