diff options
author | 2015-08-27 20:55:34 +0000 | |
---|---|---|
committer | 2015-08-27 20:55:34 +0000 | |
commit | 9e4a9586415f5c57fb8894cc594d1a9d91e5d5f9 (patch) | |
tree | fb368d4a85caeb0526573d45a7c8d80c9d95b7b9 | |
parent | size for free() (diff) | |
download | wireguard-openbsd-9e4a9586415f5c57fb8894cc594d1a9d91e5d5f9.tar.xz wireguard-openbsd-9e4a9586415f5c57fb8894cc594d1a9d91e5d5f9.zip |
If we take the address of a function pointer, we might get a pointer to
a plabel instead of the entry-point address. In that case, get the
entry-point address from the plabel. Makes ld.so work on hppa when
_dl_bind_start gets hidden by the version script.
ok miod@
-rw-r--r-- | libexec/ld.so/hppa/rtld_machine.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libexec/ld.so/hppa/rtld_machine.c b/libexec/ld.so/hppa/rtld_machine.c index f3140ae0aa1..35725a11c04 100644 --- a/libexec/ld.so/hppa/rtld_machine.c +++ b/libexec/ld.so/hppa/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.30 2015/08/27 04:10:35 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.31 2015/08/27 20:55:34 kettenis Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -391,8 +391,16 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) got[-2] = (Elf_Addr)&_dl_bind_start; got[-1] = ltp; /* + * We need the real address of the trampoline. Get it + * from the function descriptor if that's what we got. + */ + if (got[-2] & 2) { + hppa_plabel_t *p = (hppa_plabel_t *)(got[-2] & ~2); + got[-2] = p->pc; + } + /* * Even though we didn't modify any instructions it - * seems we still need to syncronize the caches. + * seems we still need to synchronize the caches. * There may be instructions in the same cache line * and they end up being corrupted otherwise. */ |