summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2019-04-21 03:41:14 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2019-04-21 03:41:14 +0000
commit71b3650713950a82f5bc9fff2ab1a4a76d8ff81f (patch)
treeeac32a6ec8b0c614cdeecbb61142e71eea2018b6 /libexec
parent3ad6b2ca83aa3958b418e51cc832eb9e567555fb (diff)
On alpha, the buckets of DT_HASH are 8 bytes instead of 4 bytes. This was
previously 'implemented' by having the Elf_Word typedef in <sys/exec_elf.h> vary, but that doesn't match the spec and breaks libelf so it's gone away. Implement the variation here by defining our own type locally for this. ok deraadt@
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/resolve.c6
-rw-r--r--libexec/ld.so/resolve.h13
2 files changed, 13 insertions, 6 deletions
diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c
index c1f9eddfb44..97df474a04e 100644
--- a/libexec/ld.so/resolve.c
+++ b/libexec/ld.so/resolve.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolve.c,v 1.87 2018/11/28 03:18:00 guenther Exp $ */
+/* $OpenBSD: resolve.c,v 1.88 2019/04/21 03:41:13 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -403,8 +403,8 @@ _dl_finalize_object(const char *objname, Elf_Dyn *dynp, Elf_Phdr *phdrp,
}
}
if (object->Dyn.info[DT_HASH] != 0) {
- Elf_Word *hashtab = (Elf_Word *)(object->Dyn.info[DT_HASH]
- + obase);
+ Elf_Hash_Word *hashtab =
+ (Elf_Hash_Word *)(object->Dyn.info[DT_HASH] + obase);
object->nchains = hashtab[1];
if (object->nbuckets == 0) {
diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h
index 62c1327b3ef..9a5f0c66b59 100644
--- a/libexec/ld.so/resolve.h
+++ b/libexec/ld.so/resolve.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolve.h,v 1.88 2018/12/05 04:28:32 guenther Exp $ */
+/* $OpenBSD: resolve.h,v 1.89 2019/04/21 03:41:13 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -47,6 +47,13 @@ struct load_list {
long foff;
};
+/* Alpha uses 8byte entries for DT_HASH */
+#ifdef __alpha__
+typedef uint64_t Elf_Hash_Word;
+#else
+typedef uint32_t Elf_Hash_Word;
+#endif
+
/*
* Structure describing a loaded object.
* The head of this struct must be compatible
@@ -137,8 +144,8 @@ struct elf_object {
union {
struct {
/* specific to ELF hash */
- const Elf_Word *buckets;
- const Elf_Word *chains;
+ const Elf_Hash_Word *buckets;
+ const Elf_Hash_Word *chains;
} u_elf;
struct {
/* specific to GNU hash */