diff --git a/elfo b/elfo index a6d1ca74b98b7a74a7983db5d55711d78df31aad..770f9ee1309d1c1f4f3deb2310525319781af61c 160000 --- a/elfo +++ b/elfo @@ -1 +1 @@ -Subproject commit a6d1ca74b98b7a74a7983db5d55711d78df31aad +Subproject commit 770f9ee1309d1c1f4f3deb2310525319781af61c diff --git a/src/analyze_x86.hpp b/src/analyze_x86.hpp index a8376d0d12dd15c400828415c29f250a7761eb50..88753910770977181e2c215ca102e10f689a3dec 100644 --- a/src/analyze_x86.hpp +++ b/src/analyze_x86.hpp @@ -327,7 +327,7 @@ class AnalyzeX86 : public Analyze<C> { this->debug_stream << " \e[3m["; if (relocation->symbol_index() == 0) { // No Symbol - calculate target value and add as reference - Bean::dump_address(this->debug_stream, Relocator(*relocation).value(0), this->symbols); + Bean::dump_address(this->debug_stream, Relocator(*relocation).value(), this->symbols); } else { // Get relocation symbol const auto rel_sym = relocation->symbol(); diff --git a/src/bean.cpp b/src/bean.cpp index b9269daa2048ef29c86f27912b6a7c545d2bd0ce..ee3e1843bcd2f5c44aad5e32bf225f2a58521744 100644 --- a/src/bean.cpp +++ b/src/bean.cpp @@ -52,7 +52,7 @@ Bean::SymbolRelocation::SymbolRelocation(const typename ELF<ELF_Def::Identificat if (is(machine).in(Elf::EM_386, Elf::EM_486) && relocation.type() == ELF<ELF_Def::Identification::ELFCLASS64>::R_386_RELATIVE) target = addend; else if (resolve_target) - target = Relocator(relocation, global_offset_table).value(0); + target = Relocator(relocation, global_offset_table).value(); } } @@ -72,7 +72,7 @@ Bean::SymbolRelocation::SymbolRelocation(const typename ELF<ELF_Def::Identificat if (machine == Elf::EM_X86_64 && is(relocation.type()).in(ELF<ELF_Def::Identification::ELFCLASS64>::R_X86_64_RELATIVE, ELF<ELF_Def::Identification::ELFCLASS64>::R_X86_64_RELATIVE64)) target = addend; else if (resolve_target) - target = Relocator(relocation, global_offset_table).value(0); + target = Relocator(relocation, global_offset_table).value(); } } @@ -250,6 +250,7 @@ TreeMap<uintptr_t, uintptr_t> Bean::map(const Bean & other, bool use_symbol_name continue; else if (const auto & map_sym = mapping.find(sym.address)) if (const auto & other_sym = other.symbols.find(map_sym->value)) + // TODO: If at least one relocation points to a skipped internal id, do not proceed for this symbol for (const auto & rel : sym.rels) if ((rel.instruction_access & Bean::SymbolRelocation::ACCESSFLAG_BRANCH) != 0 && (rel.instruction_access & Bean::SymbolRelocation::ACCESSFLAG_LOCAL) != 0) { const auto offset = rel.target - sym.address;