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-10-26 22:07:51 +09:00
parent dde40ea54e
commit 04b9541519
2 changed files with 8 additions and 4 deletions

View File

@ -195,10 +195,13 @@ void ObjectFile::register_defined_symbols() {
for (int i = 0, j = first_global; j < elf_syms.size(); i++, j++) {
if (!elf_syms[j].isDefined())
continue;
if (sections[elf_syms[j].st_shndx] == nullptr)
continue;
// num_defined++;
InputSection *isec = sections[elf_syms[j].st_shndx];
if (isec == nullptr)
continue;
Symbol *sym = symbols[i];
bool is_weak = (elf_syms[j].getBinding() == STB_WEAK);
Spinlock lock(sym->lock);
@ -206,6 +209,7 @@ void ObjectFile::register_defined_symbols() {
if (!sym->file || this->priority < sym->file->priority ||
(sym->is_weak && !is_weak)) {
sym->file = this;
sym->input_section = isec;
sym->visibility = elf_syms[j].getVisibility();
sym->is_weak = is_weak;
}
@ -275,7 +279,7 @@ void ObjectFile::fix_sym_addrs() {
if (symbols[i]->file != this)
continue;
InputSection *isec = sections[elf_syms[j].st_shndx];
InputSection *isec = symbols[i]->input_section;
OutputSection *osec = isec->output_section;
symbols[i]->addr = osec->shdr.sh_addr + isec->offset + elf_syms[j].st_value;
}

2
mold.h
View File

@ -166,7 +166,7 @@ public:
std::atomic_flag lock = ATOMIC_FLAG_INIT;
StringRef name;
ObjectFile *file = nullptr;
InputSection *isec = nullptr;
InputSection *input_section = nullptr;
uint64_t addr = 0;
uint8_t visibility = 0;