summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-06-05 14:52:27 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-06-05 14:52:27 +0000
commitb2c94a406890cd2ce9e217e8815ac58d49d90d00 (patch)
tree8a1ff7a6e81eb5ac88631e5a408f9668fdd79054 /libexec
parentb306a3021d9d87d4189e67b560ef4d092ea61611 (diff)
gcc generates a lot of unaligned RELATIVE relocations for c++ exception handlers.
Workaround that.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/alpha/rtld_machine.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c
index e3271f1b603..20a7147bf8f 100644
--- a/libexec/ld.so/alpha/rtld_machine.c
+++ b/libexec/ld.so/alpha/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.5 2001/05/31 23:49:08 art Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.6 2001/06/05 14:52:26 art Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -118,7 +118,23 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
*r_addr += ooff + this->st_value + relas->r_addend;
break;
case R_TYPE(RELATIVE):
- *r_addr += loff;
+ /*
+ * There is a lot of unaligned RELATIVE
+ * relocs generated by gcc in the exception handlers.
+ */
+ if ((((Elf_Addr) r_addr) & 0x7) != 0) {
+ Elf_Addr tmp;
+#if 0
+_dl_printf("unaligned RELATIVE: %p type: %d %s:%s 0x%lx -> 0x%lx\n", r_addr,
+ELF_R_TYPE(relas->r_info), object->load_name, symn, *r_addr,
+*r_addr+loff);
+#endif
+ _dl_bcopy(r_addr, &tmp, sizeof(Elf_Addr));
+ tmp += loff;
+ _dl_bcopy(&tmp, r_addr, sizeof(Elf_Addr));
+ } else {
+ *r_addr += loff;
+ }
break;
case R_TYPE(JMP_SLOT):
ooff = _dl_find_symbol(symn, _dl_objects, &this, 0, 1);