diff options
author | Abseil Team <absl-team@google.com> | 2018-05-14T14·57-0700 |
---|---|---|
committer | jueminyang <jueminyang@google.com> | 2018-05-14T17·15-0400 |
commit | add89fd0e4bfd7d874bb55b67f4e13bf8beca762 (patch) | |
tree | d33fe008a0b8b6764d062f8c9f6f59b624515728 /absl/debugging | |
parent | dd9911a004edcc34152850a6216bb3b53ad6bb82 (diff) |
- 6194c9b0d6dbdbeeb27b19d5c61562f985b25ff2 Removing support for NaCL in dynamic_annotations.h. by Abseil Team <absl-team@google.com>
- 6f89386971a21422c4cd9653e965c96d9f7a3573 Fix handling of VDSOs that are loaded lower then their li... by Abseil Team <absl-team@google.com> - f27a7269ab714c9c75fe4e15fa1bce8b12531a92 Check that __GLIBC__ is defined before checking for __GLI... by Derek Mauro <dmauro@google.com> GitOrigin-RevId: 6194c9b0d6dbdbeeb27b19d5c61562f985b25ff2 Change-Id: I3eceb6f76bf2b25d55d1f5f77fba57af947da0cf
Diffstat (limited to 'absl/debugging')
-rw-r--r-- | absl/debugging/internal/elf_mem_image.cc | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/absl/debugging/internal/elf_mem_image.cc b/absl/debugging/internal/elf_mem_image.cc index d6d519246036..3f747e7f958e 100644 --- a/absl/debugging/internal/elf_mem_image.cc +++ b/absl/debugging/internal/elf_mem_image.cc @@ -121,7 +121,7 @@ const void *ElfMemImage::GetSymAddr(const ElfW(Sym) *sym) const { return reinterpret_cast<const void *>(sym->st_value); } ABSL_RAW_CHECK(link_base_ < sym->st_value, "symbol out of range"); - return GetTableElement<char>(ehdr_, 0, 1, sym->st_value) - link_base_; + return GetTableElement<char>(ehdr_, 0, 1, sym->st_value - link_base_); } const ElfW(Verdef) *ElfMemImage::GetVerdef(int index) const { @@ -161,10 +161,6 @@ void ElfMemImage::Init(const void *base) { if (!base) { return; } - const intptr_t base_as_uintptr_t = reinterpret_cast<uintptr_t>(base); - // Fake VDSO has low bit set. - const bool fake_vdso = ((base_as_uintptr_t & 1) != 0); - base = reinterpret_cast<const void *>(base_as_uintptr_t & ~1); const char *const base_as_char = reinterpret_cast<const char *>(base); if (base_as_char[EI_MAG0] != ELFMAG0 || base_as_char[EI_MAG1] != ELFMAG1 || base_as_char[EI_MAG2] != ELFMAG2 || base_as_char[EI_MAG3] != ELFMAG3) { @@ -224,21 +220,7 @@ void ElfMemImage::Init(const void *base) { reinterpret_cast<ElfW(Dyn) *>(dynamic_program_header->p_vaddr + relocation); for (; dynamic_entry->d_tag != DT_NULL; ++dynamic_entry) { - ElfW(Xword) value = dynamic_entry->d_un.d_val; - if (fake_vdso) { - // A complication: in the real VDSO, dynamic entries are not relocated - // (it wasn't loaded by a dynamic loader). But when testing with a - // "fake" dlopen()ed vdso library, the loader relocates some (but - // not all!) of them before we get here. - if (dynamic_entry->d_tag == DT_VERDEF) { - // The only dynamic entry (of the ones we care about) libc-2.3.6 - // loader doesn't relocate. - value += relocation; - } - } else { - // Real VDSO. Everything needs to be relocated. - value += relocation; - } + const ElfW(Xword) value = dynamic_entry->d_un.d_val + relocation; switch (dynamic_entry->d_tag) { case DT_HASH: hash_ = reinterpret_cast<ElfW(Word) *>(value); |