diff options
Diffstat (limited to 'gold/dynobj.cc')
-rw-r--r-- | gold/dynobj.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gold/dynobj.cc b/gold/dynobj.cc index d2ba8ae..3b2031f 100644 --- a/gold/dynobj.cc +++ b/gold/dynobj.cc @@ -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> |