From 2cc93f4fea00ddb94de0c8abf7faa34f6f94d092 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 25 Jan 2021 17:59:18 +0900 Subject: [PATCH] wip --- gc_sections.cc | 4 ++-- mold.h | 12 ++++++------ object_file.cc | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gc_sections.cc b/gc_sections.cc index 122b4fb6..f8efdd89 100644 --- a/gc_sections.cc +++ b/gc_sections.cc @@ -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); } diff --git a/mold.h b/mold.h index 3cc95923..dfb9d104 100644 --- a/mold.h +++ b/mold.h @@ -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 } diff --git a/object_file.cc b/object_file.cc index 19a8b598..b89c128c 100644 --- a/object_file.cc +++ b/object_file.cc @@ -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;