aboutsummaryrefslogtreecommitdiff
path: root/bsd-user
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-user')
-rw-r--r--bsd-user/elfload.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 1288884..55b2136 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -993,12 +993,12 @@ static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex,
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;
@@ -1013,12 +1013,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;
}