Skip to content

Commit

Permalink
Add more log
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzijian629 committed Jul 19, 2023
1 parent 387d5cd commit 8b4d972
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion symtab_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ void SymtabBuilder::SetSrcSyms(std::vector<Syminfo> syms) {
// unique symbols therefore found == src_syms_.end() is true always.
if (found == src_syms_.end() || found->second.second == NULL || !IsDefined(*found->second.second)) {
src_syms_[{s.name, s.soname, s.version}] = {s.versym, s.sym};
LOG(INFO) << "SymtabBuilder set src_syms_:" << SOLD_LOG_KEY(s.name) << SOLD_LOG_KEY(s.soname) << SOLD_LOG_KEY(s.version)
<< SOLD_LOG_KEY(s.versym);
}

auto found_fallback = src_fallback_syms_.find(s.name);
if ((s.versym & VERSYM_HIDDEN) == 0 && (found_fallback == src_fallback_syms_.end() || found_fallback->second.second == NULL ||
!IsDefined(*found_fallback->second.second))) {
src_fallback_syms_[s.name] = {s.versym, s.sym};
LOG(INFO) << "SymtabBuilder set src_fallback_syms_:" << SOLD_LOG_KEY(s.name) << SOLD_LOG_KEY(s.soname)
<< SOLD_LOG_KEY(s.version) << SOLD_LOG_KEY(s.versym);
}
}
}
Expand Down Expand Up @@ -85,12 +89,27 @@ bool SymtabBuilder::Resolve(const std::string& name, const std::string& soname,
if (found != src_syms_.end()) {
versym = found->second.first;
symp = found->second.second;
LOG(INFO) << "Found src_syms_:" << SOLD_LOG_KEY(name) << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version)
<< ", resolved version:" << SOLD_LOG_KEY(versym);
} else {
auto found_fallback = src_fallback_syms_.find(name);
if (found_fallback != src_fallback_syms_.end()) {
LOG(INFO) << "Use fallback version of " << name;
versym = found_fallback->second.first;
symp = found_fallback->second.second;
LOG(INFO) << "Use fallback version: " << SOLD_LOG_KEY(name) << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version)
<< ", resolved version:" << SOLD_LOG_KEY(versym);

// TODO(joe): Check whether this is correct behavior or not.
// We have so far disabled this kind of checks in
// https://github.com/pfnet/sold/pull/6 and
// https://github.com/pfnet/sold/pull/15.
// If the following behavior is correct, we have to revive the checks.
if (is_special_ver_ndx(versym) != (soname.empty() && version.empty())) {
LOG(WARNING) << "Unexpected combination of versym, soname, and version. "
<< "A symbol is expected to have special versym iff its soname and version are empty. "
<< "Resoved:" << SOLD_LOG_KEY(name) << SOLD_LOG_KEY(soname) << SOLD_LOG_KEY(version)
<< SOLD_LOG_KEY(versym);
}
}
}
}
Expand Down

0 comments on commit 8b4d972

Please sign in to comment.