diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2005-01-09 17:57:41 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2005-01-09 17:57:41 +0000 |
commit | 4914b417371e3df3d9c7c97001ff0396141f1b15 (patch) | |
tree | e2f7a1af2045be779435d5855c2e283adc01808c /libexec/ld.so | |
parent | e50cd3334bf7d40700c78ab3bcfb937fcdbce0c7 (diff) |
set %dp before any constructors get to run; found and debugged w/ niklas@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/hppa/ldasm.S | 10 | ||||
-rw-r--r-- | libexec/ld.so/hppa/rtld_machine.c | 12 |
2 files changed, 20 insertions, 2 deletions
diff --git a/libexec/ld.so/hppa/ldasm.S b/libexec/ld.so/hppa/ldasm.S index 80ad86e1fc7..b7f59ab7937 100644 --- a/libexec/ld.so/hppa/ldasm.S +++ b/libexec/ld.so/hppa/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.2 2004/05/25 21:56:49 deraadt Exp $ */ +/* $OpenBSD: ldasm.S,v 1.3 2005/01/09 17:57:40 mickey Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -59,6 +59,9 @@ ENTRY(_dl_start,32) ADDR(_DYNAMIC, arg2) stw arg2, HPPA_FRAME_ARG(1)(r3) + /* make sure to get a fault until it's set proper */ + ldi -1, %dp + ldw 0(arg0), arg0 ldo 4(r3), arg1 /* dl_data */ bl _dl_boot_bind, rp @@ -94,6 +97,11 @@ ENTRY(_hppa_dl_dtors,0) nop EXIT(_hppa_dl_dtors) +LEAF_ENTRY(_hppa_dl_set_dp) + bv r0(rp) + copy arg0, r27 +EXIT(_hppa_dl_set_dp) + /* * void hppa_call(void (*arg)(void), void *r19, Elf_Addr func); */ diff --git a/libexec/ld.so/hppa/rtld_machine.c b/libexec/ld.so/hppa/rtld_machine.c index 5e59c32689d..48f677b895d 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.6 2004/06/07 15:19:59 mickey Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.7 2005/01/09 17:57:40 mickey Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -53,6 +53,8 @@ struct hppa_plabel { } hppa_plabel_t; SPLAY_HEAD(_dl_md_plabels, hppa_plabel) _dl_md_plabel_root; +void _hppa_dl_set_dp(Elf_Addr *dp); /* from ldasm.S */ + static __inline int _dl_md_plcmp(hppa_plabel_t *a, hppa_plabel_t *b) { @@ -131,6 +133,14 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) object->dyn.fini = (void *)addr; } + /* + * this is normally done by the crt0 code but we have to make + * sure it's set here to allow constructors to call functions + * that are overriden in the user binary (that are un-pic) + */ + if (object->obj_type == OBJTYPE_EXE) + _hppa_dl_set_dp(object->dyn.pltgot); + for (i = 0; i < numrela; i++, rela++) { const elf_object_t *sobj; const Elf_Sym *sym, *this; |