diff options
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/elfload.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index ea61d0d..845be8b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1683,12 +1683,12 @@ static void load_elf_interp(const char *filename, struct image_info *info, static int symfind(const void *s0, const void *s1) { - struct elf_sym *key = (struct elf_sym *)s0; + target_ulong addr = *(target_ulong *)s0; struct elf_sym *sym = (struct elf_sym *)s1; int result = 0; - if (key->st_value < sym->st_value) { + if (addr < sym->st_value) { result = -1; - } else if (key->st_value >= sym->st_value + sym->st_size) { + } else if (addr >= sym->st_value + sym->st_size) { result = 1; } return result; @@ -1703,12 +1703,9 @@ static const char *lookup_symbolxx(struct syminfo *s, target_ulong orig_addr) #endif // binary search - struct elf_sym key; struct elf_sym *sym; - key.st_value = orig_addr; - - sym = bsearch(&key, syms, s->disas_num_syms, sizeof(*syms), symfind); + sym = bsearch(&orig_addr, syms, s->disas_num_syms, sizeof(*syms), symfind); if (sym != NULL) { return s->disas_strtab + sym->st_name; } |