section-select: Fix exclude-file-3
authorMichael Matz <matz@suse.de>
Wed, 16 Nov 2022 15:28:01 +0000 (16:28 +0100)
committerMichael Matz <matz@suse.de>
Wed, 30 Nov 2022 16:15:08 +0000 (17:15 +0100)
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
ld/testsuite/ld-scripts/exclude-file-3.map

index 2dfc42099ed6df05c851e91105b81ca395ab11b6..d873adb8d9c7a23094278b1d8bce008e7a116118 100644 (file)
@@ -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);
index 389d1708c900bca5a0aefad7999a7e278bce9d1c..255182030ca94ad12a64502151535855678e3968 100644 (file)
@@ -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
+#...