1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00
This commit is contained in:
Rui Ueyama 2021-01-25 17:59:18 +09:00
parent 61f833b93f
commit 2cc93f4fea
3 changed files with 12 additions and 12 deletions

View File

@ -30,8 +30,8 @@ static void visit(InputSection *isec,
for (ElfRela &rel : isec->rels) {
Symbol &sym = *isec->file->symbols[rel.r_sym];
if (sym.frag_ref.frag)
sym.frag_ref.frag->is_alive = true;
if (sym.fragref.frag)
sym.fragref.frag->is_alive = true;
else
enqueue(sym.input_section);
}

12
mold.h
View File

@ -259,7 +259,7 @@ public:
InputFile *file = nullptr;
const ElfSym *esym = nullptr;
InputSection *input_section = nullptr;
SectionFragmentRef frag_ref;
SectionFragmentRef fragref;
u64 value = -1;
u32 got_idx = -1;
@ -1161,8 +1161,8 @@ inline u64 next_power_of_two(u64 val) {
}
inline bool Symbol::is_alive() const {
if (frag_ref.frag)
return frag_ref.frag->is_alive;
if (fragref.frag)
return fragref.frag->is_alive;
if (input_section)
return input_section->is_alive;
return true;
@ -1173,9 +1173,9 @@ inline bool Symbol::is_absolute() const {
}
inline u64 Symbol::get_addr() const {
if (frag_ref.frag) {
if (frag_ref.frag->is_alive)
return frag_ref.frag->get_addr() + frag_ref.addend;
if (fragref.frag) {
if (fragref.frag->is_alive)
return fragref.frag->get_addr() + fragref.addend;
return 0; // todo: do not return 0
}

View File

@ -460,8 +460,8 @@ void ObjectFile::initialize_mergeable_sections() {
Fatal() << *this << ": bad symbol value";
if (i < first_global) {
symbols[i]->frag_ref.frag = m->fragments[idx];
symbols[i]->frag_ref.addend = esym.st_value - m->frag_offsets[idx];
symbols[i]->fragref.frag = m->fragments[idx];
symbols[i]->fragref.addend = esym.st_value - m->frag_offsets[idx];
} else {
sym_fragments[i - first_global].frag = m->fragments[idx];
sym_fragments[i - first_global].addend = esym.st_value - m->frag_offsets[idx];
@ -530,7 +530,7 @@ void ObjectFile::maybe_override_symbol(Symbol &sym, i64 symidx) {
if (new_rank < existing_rank) {
sym.file = this;
sym.input_section = isec;
sym.frag_ref = sym_fragments[symidx - first_global];
sym.fragref = sym_fragments[symidx - first_global];
sym.value = esym.st_value;
sym.ver_idx = 0;
sym.st_type = esym.st_type;
@ -955,7 +955,7 @@ void SharedFile::resolve_symbols() {
if (new_rank < existing_rank) {
sym.file = this;
sym.input_section = nullptr;
sym.frag_ref = {};
sym.fragref = {};
sym.value = esym.st_value;
sym.ver_idx = versyms[i];
sym.st_type = (esym.st_type == STT_GNU_IFUNC) ? STT_FUNC : esym.st_type;