1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-16 19:15:27 +09:00
parent 9b9806c989
commit 7751e9401b
3 changed files with 12 additions and 8 deletions

View File

@ -1062,7 +1062,7 @@ int main(int argc, char **argv) {
if (args.hasArg(OPT_trace))
for (ObjectFile *file : files)
llvm::outs() << toString(file) << "\n";
message(toString(file));
// Remove redundant comdat sections (e.g. duplicate inline functions).
eliminate_comdats(files);
@ -1289,7 +1289,7 @@ int main(int argc, char **argv) {
for (ObjectFile *file : files)
for (InputSection *isec : file->sections)
if (isec)
llvm::outs() << toString(isec) << "\n";
message(toString(isec));
#endif
// Show stat numbers

6
mold.h
View File

@ -109,6 +109,12 @@ T check2(Expected<T> e, llvm::function_ref<std::string()> prefix) {
return std::move(*e);
}
inline void message(const Twine &msg) {
static std::mutex mu;
std::lock_guard lock(mu);
llvm::outs() << msg << "\n";
}
inline std::string toString(const Twine &s) { return s.str(); }
#define CHECK(E, S) check2((E), [&] { return toString(S); })

View File

@ -391,16 +391,15 @@ ObjectFile::mark_live_archive_members(tbb::parallel_do_feeder<ObjectFile *> &fee
}
if (UNLIKELY(sym.traced))
llvm::outs() << "trace: " << toString(this)
<< ": reference to " << sym.name << "\n";
message("trace: " + toString(this) + ": reference to " + sym.name);
if (esym.getBinding() != STB_WEAK && sym.file &&
!sym.file->is_alive.exchange(true)) {
feeder.add(sym.file);
if (UNLIKELY(sym.traced))
llvm::outs() << "trace: " << toString(this) << " keeps "
<< toString(sym.file) << " for " << sym.name << "\n";
message("trace: " + toString(this) + " keeps " + toString(sym.file) +
" for " + sym.name);
}
}
}
@ -429,8 +428,7 @@ void ObjectFile::hanlde_undefined_weak_symbols() {
sym.is_undef_weak = true;
if (UNLIKELY(sym.traced))
llvm::outs() << "trace: " << toString(this)
<< ": unresolved weak symbol " << sym.name << "\n";
message("trace: " + toString(this) + ": unresolved weak symbol " + sym.name);
}
}
}