Add new NOCROSSREFS_TO linker script command
[deliverable/binutils-gdb.git] / ld / ldcref.c
index b87f384754d92fd04cd20c2afa0b64a02380f122..d96db203d95fc3290622be48bc3b5d1d67e78738 100644 (file)
@@ -534,8 +534,14 @@ check_local_sym_xref (lang_input_statement_type *statement)
            symname = sym->name;
          for (ncrs = nocrossref_list; ncrs != NULL; ncrs = ncrs->next)
            for (ncr = ncrs->list; ncr != NULL; ncr = ncr->next)
-             if (strcmp (ncr->name, outsecname) == 0)
-               check_refs (symname, FALSE, sym->section, abfd, ncrs);
+             {
+               if (strcmp (ncr->name, outsecname) == 0)
+                 check_refs (symname, FALSE, sym->section, abfd, ncrs);
+               /* The NOCROSSREFS_TO command only checks symbols defined in
+                  the first section in the list.  */
+               if (ncrs->onlyfirst)
+                 break;
+             }
        }
     }
 }
@@ -572,10 +578,16 @@ check_nocrossref (struct cref_hash_entry *h, void *ignore ATTRIBUTE_UNUSED)
 
   for (ncrs = nocrossref_list; ncrs != NULL; ncrs = ncrs->next)
     for (ncr = ncrs->list; ncr != NULL; ncr = ncr->next)
-      if (strcmp (ncr->name, defsecname) == 0)
-       for (ref = h->refs; ref != NULL; ref = ref->next)
-         check_refs (hl->root.string, TRUE, hl->u.def.section,
-                     ref->abfd, ncrs);
+      {
+       if (strcmp (ncr->name, defsecname) == 0)
+         for (ref = h->refs; ref != NULL; ref = ref->next)
+           check_refs (hl->root.string, TRUE, hl->u.def.section,
+                       ref->abfd, ncrs);
+       /* The NOCROSSREFS_TO command only checks symbols defined in the first
+          section in the list.  */
+       if (ncrs->onlyfirst)
+         break;
+      }
 
   return TRUE;
 }
This page took 0.028494 seconds and 4 git commands to generate.