summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2013-01-13 18:44:55 +0000
committermiod <miod@openbsd.org>2013-01-13 18:44:55 +0000
commit6e0ab81dbd235a5440502a086a8faf65a57a248a (patch)
tree45c6497df10091455446e6d7b7a1a84195789769
parentTweak whitespace, add missing #defines, use DHO_RELAY_AGENT_INFORMATION (diff)
downloadwireguard-openbsd-6e0ab81dbd235a5440502a086a8faf65a57a248a.tar.xz
wireguard-openbsd-6e0ab81dbd235a5440502a086a8faf65a57a248a.zip
Correctly process RELOC_DIR32 while relocating ld.so itself; this allow
global data initializers to work as intended. ok drahn kettenis@
-rw-r--r--libexec/ld.so/hppa/archdep.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/libexec/ld.so/hppa/archdep.h b/libexec/ld.so/hppa/archdep.h
index 250553bb42d..844d1848793 100644
--- a/libexec/ld.so/hppa/archdep.h
+++ b/libexec/ld.so/hppa/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.5 2010/01/02 12:16:35 kettenis Exp $ */
+/* $OpenBSD: archdep.h,v 1.6 2013/01/13 18:44:55 miod Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
@@ -67,19 +67,15 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
_dl_exit(20);
}
-/*
- * !!!!! WARNING: THIS CODE CANNOT HANDLE ld.so RELOCATIONS OF THE FORM
- * 0000bde8 R_PARISC_DIR32 .data+0x00000048
- * these can be caused by static intialization foo = &bar;
- * prepare to code around this problem, or fix it here.
- */
static inline void
RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v,
Elf_Addr *pltgot)
{
- /* XXX fille out _sl ??? */
if (ELF_R_TYPE(r->r_info) == RELOC_DIR32) {
- *p = v + r->r_addend;
+ if (ELF_R_SYM(r->r_info) != 0)
+ *p = v + s->st_value + r->r_addend;
+ else
+ *p = v + r->r_addend;
} else if (ELF_R_TYPE(r->r_info) == RELOC_IPLT) {
p[0] = v + s->st_value + r->r_addend;
p[1] = (Elf_Addr)pltgot;