diff --git a/gdb/symtab.c b/gdb/symtab.c
index 93684c14777..13824587e75 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4750,22 +4750,20 @@ global_symbol_searcher::expand_symtabs
      SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
      kind);
 
-  /* Here, we search through the minimal symbol tables for functions and
-     variables that match, and force their symbols to be read.  This is in
-     particular necessary for demangled variable names, which are no longer
-     put into the partial symbol tables.  The symbol will then be found
+  /* Here, we search through the minimal symbol tables for functions that
+     match, and force their symbols to be read.  The symbol will then be found
      during the scan of symtabs later.
 
-     For functions, find_pc_symtab should succeed if we have debug info for
-     the function, for variables we have to call
-     lookup_symbol_in_objfile_from_linkage_name to determine if the
-     variable has debug info.  If the lookup fails, set found_msymbol so
-     that we will rescan to print any matching symbols without debug info.
-     We only search the objfile the msymbol came from, we no longer search
-     all objfiles.  In large programs (1000s of shared libs) searching all
-     objfiles is not worth the pain.  */
+     The find_compunit_symtab_for_pc should succeed if we have debug info for
+     the function.  If it fails, set found_msymbol so that we will rescan to
+     print any matching symbols without debug info.  We only search the
+     objfile the msymbol came from, we no longer search all objfiles.
+
+     Variables are not handled here, and looking them up does not expand any
+     symtab.  When no file names were given the caller unconditionally rescans
+     the minimal symbols for SEARCH_VAR_DOMAIN.  */
   if (m_filenames.empty ()
-      && (kind & (SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN)) != 0)
+      && (kind & SEARCH_FUNCTION_DOMAIN) != 0)
     {
       for (minimal_symbol *msymbol : objfile->msymbols ())
 	{
@@ -4780,18 +4778,13 @@ global_symbol_searcher::expand_symtabs
 		  || preg->exec (msymbol->natural_name (), 0,
 				 NULL, 0) == 0)
 		{
-		  /* An important side-effect of these lookup functions is
+		  /* An important side-effect of this lookup function is
 		     to expand the symbol table if msymbol is found, later
 		     in the process we will add matching symbols or
 		     msymbols to the results list, and that requires that
 		     the symbols tables are expanded.  */
-		  if ((kind & SEARCH_FUNCTION_DOMAIN) != 0
-		      ? (find_compunit_symtab_for_pc
-			 (msymbol->value_address (objfile)) == NULL)
-		      : (lookup_symbol_in_objfile_from_linkage_name
-			 (objfile, msymbol->linkage_name (),
-			  SEARCH_VFT)
-			 .symbol == NULL))
+		  if (find_compunit_symtab_for_pc
+			(msymbol->value_address (objfile)) == nullptr)
 		    found_msymbol = true;
 		}
 	    }
