diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-08-27 20:55:35 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-08-27 20:55:35 +0000 |
commit | df3cce3c78e7f44225b652079a70a337dd0df425 (patch) | |
tree | 4132aa9922e441ce60cb336d41854d6a1deca2a8 /libexec | |
parent | 732f7a4cc9f305972296e0f0ce5a78dd59d84db6 (diff) |
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@
Diffstat (limited to 'libexec')
-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. */ |