diff options
Diffstat (limited to 'lib/elf_py.c')
| -rw-r--r-- | lib/elf_py.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/elf_py.c b/lib/elf_py.c index b47aa3d795..f230add695 100644 --- a/lib/elf_py.c +++ b/lib/elf_py.c @@ -636,6 +636,9 @@ static Elf_Scn *elf_find_addr(struct elffile *ef, uint64_t addr, size_t *idx) Elf_Scn *scn = elf_getscn(ef->elf, i); GElf_Shdr _shdr, *shdr = gelf_getshdr(scn, &_shdr); + /* virtual address is kinda meaningless for TLS sections */ + if (shdr->sh_flags & SHF_TLS) + continue; if (addr < shdr->sh_addr || addr >= shdr->sh_addr + shdr->sh_size) continue; @@ -860,6 +863,7 @@ static PyObject *elffile_find_note(PyObject *self, PyObject *args) Py_RETURN_NONE; } +#ifdef HAVE_ELF_GETDATA_RAWCHUNK static bool elffile_virt2file(struct elffile *w, GElf_Addr virt, GElf_Addr *offs) { @@ -884,6 +888,7 @@ static bool elffile_virt2file(struct elffile *w, GElf_Addr virt, return false; } +#endif /* HAVE_ELF_GETDATA_RAWCHUNK */ static PyObject *elffile_subscript(PyObject *self, PyObject *key) { @@ -1016,6 +1021,7 @@ static PyTypeObject typeobj_elffile = { .tp_methods = methods_elffile, }; +#ifdef HAVE_ELF_GETDATA_RAWCHUNK static char *elfdata_strptr(Elf_Data *data, size_t offset) { char *p; @@ -1124,6 +1130,7 @@ static void elffile_add_dynreloc(struct elffile *w, Elf_Data *reldata, } } +#endif /* HAVE_ELF_GETDATA_RAWCHUNK */ /* primary (only, really) entry point to anything in this module */ static PyObject *elffile_load(PyTypeObject *type, PyObject *args, |
