daily update
[deliverable/binutils-gdb.git] / gold / dynobj.cc
index d2ba8aec27126bfd4f07ad7d03a6377c670c5dc0..3b2031ff51b7b71971b5fe4bcc5f60eced08b837 100644 (file)
@@ -761,6 +761,32 @@ Sized_dynobj<size, big_endian>::do_should_include_member(Symbol_table*,
   return Archive::SHOULD_INCLUDE_YES;
 }
 
+// Iterate over global symbols, calling a visitor class V for each.
+
+template<int size, bool big_endian>
+void
+Sized_dynobj<size, big_endian>::do_for_all_global_symbols(
+    Read_symbols_data* sd,
+    Library_base::Symbol_visitor_base* v)
+{
+  const char* sym_names =
+      reinterpret_cast<const char*>(sd->symbol_names->data());
+  const unsigned char* syms =
+      sd->symbols->data() + sd->external_symbols_offset;
+  const int sym_size = elfcpp::Elf_sizes<size>::sym_size;
+  size_t symcount = ((sd->symbols_size - sd->external_symbols_offset)
+                     / sym_size);
+  const unsigned char* p = syms;
+
+  for (size_t i = 0; i < symcount; ++i, p += sym_size)
+    {
+      elfcpp::Sym<size, big_endian> sym(p);
+      if (sym.get_st_shndx() != elfcpp::SHN_UNDEF
+         && sym.get_st_bind() != elfcpp::STB_LOCAL)
+       v->visit(sym_names + sym.get_st_name());
+    }
+}
+
 // Get symbol counts.
 
 template<int size, bool big_endian>
This page took 0.023167 seconds and 4 git commands to generate.