1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 19:04:27 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-28 19:49:58 +09:00
parent a6f24a830a
commit d32ec60c8e
3 changed files with 3 additions and 15 deletions

View File

@ -212,9 +212,6 @@ private:
std::atomic_flag &lock; std::atomic_flag &lock;
}; };
std::atomic_int do_not_skip;
std::atomic_int skip;
void ObjectFile::register_defined_symbols() { void ObjectFile::register_defined_symbols() {
for (int i = 0; i < symbols.size(); i++) { for (int i = 0; i < symbols.size(); i++) {
const ELF64LE::Sym &esym = elf_syms[first_global + i]; const ELF64LE::Sym &esym = elf_syms[first_global + i];
@ -231,18 +228,15 @@ void ObjectFile::register_defined_symbols() {
isec = sections[shndx]; isec = sections[shndx];
bool is_weak = (esym.getBinding() == STB_WEAK); bool is_weak = (esym.getBinding() == STB_WEAK);
Spinlock lock(sym.lock); std::lock_guard lock(sym.mu);
if (!sym.file || this->priority < sym.file->priority || if (!sym.file || this->priority < sym.file->priority ||
(sym.is_weak && !is_weak)) { (sym.is_weak && !is_weak)) {
do_not_skip++;
sym.file = this; sym.file = this;
sym.input_section = isec; sym.input_section = isec;
sym.value = esym.st_value; sym.value = esym.st_value;
sym.visibility = esym.getVisibility(); sym.visibility = esym.getVisibility();
sym.is_weak = is_weak; sym.is_weak = is_weak;
} else {
skip++;
} }
} }
} }

View File

@ -435,13 +435,6 @@ int main(int argc, char **argv) {
}); });
} }
{
extern std::atomic_int do_not_skip;
extern std::atomic_int skip;
llvm::outs() << "do_not_skip=" << do_not_skip
<< " skip=" << skip << "\n";
}
// Eliminate unused archive members. // Eliminate unused archive members.
files.erase(std::remove_if(files.begin(), files.end(), files.erase(std::remove_if(files.begin(), files.end(),
[](ObjectFile *file){ return !file->is_alive; }), [](ObjectFile *file){ return !file->is_alive; }),

3
mold.h
View File

@ -21,6 +21,7 @@
#include "tbb/parallel_reduce.h" #include "tbb/parallel_reduce.h"
#include "tbb/parallel_sort.h" #include "tbb/parallel_sort.h"
#include "tbb/partitioner.h" #include "tbb/partitioner.h"
#include "tbb/spin_mutex.h"
#include "tbb/task_arena.h" #include "tbb/task_arena.h"
#include "tbb/task_group.h" #include "tbb/task_group.h"
@ -164,7 +165,7 @@ public:
return map.insert(name, Symbol(name)); return map.insert(name, Symbol(name));
} }
std::atomic_flag lock = ATOMIC_FLAG_INIT; tbb::spin_mutex mu;
StringRef name; StringRef name;
ObjectFile *file = nullptr; ObjectFile *file = nullptr;
InputSection *input_section = nullptr; InputSection *input_section = nullptr;