1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 18:40:59 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-05 13:05:27 +09:00
parent ab517ea1ee
commit b40add6092
2 changed files with 15 additions and 8 deletions

5
mold.h
View File

@ -151,8 +151,8 @@ class Symbol {
public:
Symbol(StringRef name, ObjectFile *file = nullptr)
: name(name), file(file), needs_got(false), needs_gottp(false),
needs_plt(false), is_dso(false), is_weak(false), is_undef_weak(false),
traced(false) {}
needs_plt(false), is_placeholder(false), is_dso(false), is_weak(false),
is_undef_weak(false), traced(false) {}
Symbol(const Symbol &other) : Symbol(other.name, other.file) {}
@ -178,6 +178,7 @@ public:
u8 needs_got : 1;
u8 needs_gottp : 1;
u8 needs_plt : 1;
u8 is_placeholder : 1;
u8 is_dso : 1;
u8 is_weak : 1;
u8 is_undef_weak : 1;

View File

@ -205,6 +205,18 @@ void ObjectFile::parse() {
if (symtab_sec)
initialize_symbols();
if (Counter::enabled) {
static Counter defined("defined_syms");
static Counter undefined("undefined_syms");
for (const ELF64LE::Sym &esym : elf_syms) {
if (esym.isDefined())
defined.inc();
else
undefined.inc();
}
}
}
void ObjectFile::resolve_symbols() {
@ -215,9 +227,6 @@ void ObjectFile::resolve_symbols() {
Symbol &sym = *symbols[i];
static Counter counter("defined_syms");
counter.inc();
InputSection *isec = nullptr;
if (!esym.isAbsolute() && !esym.isCommon())
isec = sections[esym.st_shndx];
@ -268,9 +277,6 @@ ObjectFile::mark_live_archive_members(tbb::parallel_do_feeder<ObjectFile *> &fee
sym.file->is_in_archive && !sym.file->is_alive) {
feeder.add(sym.file);
static Counter counter("undefined_syms");
counter.inc();
if (UNLIKELY(sym.traced))
llvm::outs() << "trace: " << toString(this) << " keeps "
<< toString(sym.file) << " for " << sym.name << "\n";