+2014-12-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * symtab.c (lookup_symbol_in_objfile_symtabs): New declaration.
+       (lookup_global_symbol_from_objfile): Call it.
+
 2014-12-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Remove const from struct objfile *.
 
                                    const domain_enum domain,
                                    enum language language);
 
+static struct symbol *
+  lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
+                                   int block_index, const char *name,
+                                   const domain_enum domain);
+
 static
 struct symbol *lookup_symbol_via_quick_fns (struct objfile *objfile,
                                            int block_index,
        objfile;
        objfile = objfile_separate_debug_iterate (main_objfile, objfile))
     {
-      struct compunit_symtab *cust;
       struct symbol *sym;
-
-      /* Go through symtabs.  */
-      ALL_OBJFILE_COMPUNITS (objfile, cust)
-       {
-         const struct blockvector *bv;
-         const struct block *block;
-
-         bv = COMPUNIT_BLOCKVECTOR (cust);
-         block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-         sym = block_lookup_symbol (block, name, domain);
-         if (sym)
-           {
-             block_found = block;
-             return fixup_symbol_section (sym, objfile);
-           }
-       }
+      
+      sym = lookup_symbol_in_objfile_symtabs (objfile, GLOBAL_BLOCK, name,
+                                             domain);
+      if (sym != NULL)
+       return sym;
 
       sym = lookup_symbol_via_quick_fns (objfile, GLOBAL_BLOCK, name, domain);
       if (sym)