From 5f60a0e30abc6c3e0a9abf7f7559bc9dbbfc3330 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Sun, 27 Nov 2022 01:28:43 +0800 Subject: [PATCH] Refine codes --- lsplt/src/main/jni/elf_util.cc | 5 ++--- lsplt/src/main/jni/elf_util.hpp | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lsplt/src/main/jni/elf_util.cc b/lsplt/src/main/jni/elf_util.cc index 2e8431a..3f57a9a 100644 --- a/lsplt/src/main/jni/elf_util.cc +++ b/lsplt/src/main/jni/elf_util.cc @@ -152,15 +152,14 @@ Elf::Elf(uintptr_t base_addr) : base_addr_(base_addr) { case DT_HASH: { // ignore DT_HASH when ELF contains DT_GNU_HASH hash table if (bloom_) continue; - auto *raw = reinterpret_cast(bias_addr_, dynamic->d_un.d_ptr); + auto *raw = reinterpret_cast(bias_addr_ + dynamic->d_un.d_ptr); bucket_count_ = raw[0]; - chain_count_ = raw[1]; bucket_ = raw + 2; chain_ = bucket_ + bucket_count_; break; } case DT_GNU_HASH: { - auto *raw = reinterpret_cast(bias_addr_, dynamic->d_un.d_ptr); + auto *raw = reinterpret_cast(bias_addr_ + dynamic->d_un.d_ptr); bucket_count_ = raw[0]; sym_offset_ = raw[1]; bloom_size_ = raw[2]; diff --git a/lsplt/src/main/jni/elf_util.hpp b/lsplt/src/main/jni/elf_util.hpp index 23f8021..86c0510 100644 --- a/lsplt/src/main/jni/elf_util.hpp +++ b/lsplt/src/main/jni/elf_util.hpp @@ -29,7 +29,6 @@ class Elf { uint32_t *bucket_ = nullptr; uint32_t bucket_count_ = 0; uint32_t *chain_ = nullptr; - uint32_t chain_count_ = 0; // invalid for GNU hash // append for GNU hash uint32_t sym_offset_ = 0;