From 7e5102989ed96d7cb3b11b8b7fb67ae4e813ed3c Mon Sep 17 00:00:00 2001 From: Jake Burkholder Date: Tue, 31 Jul 2001 03:46:39 +0000 Subject: [PATCH] Use a machine dependent type, Elf_Hashelt, for the elements of the elf dynamic symbol table buckets and chains. The sparc64 toolchain uses 32 bit .hash entries, unlike other 64 bits architectures (alpha), which use 64 bit entries. Discussed with: dfr, jdp --- sys/alpha/include/elf.h | 11 +++++++++++ sys/amd64/include/elf.h | 11 +++++++++++ sys/i386/include/elf.h | 11 +++++++++++ sys/ia64/include/elf.h | 11 +++++++++++ sys/kern/link_elf.c | 10 +++++----- sys/kern/link_elf_obj.c | 10 +++++----- sys/powerpc/include/elf.h | 11 +++++++++++ 7 files changed, 65 insertions(+), 10 deletions(-) diff --git a/sys/alpha/include/elf.h b/sys/alpha/include/elf.h index aacfb3db54b2..e57e3cb4f268 100644 --- a/sys/alpha/include/elf.h +++ b/sys/alpha/include/elf.h @@ -60,6 +60,17 @@ typedef struct { /* Auxiliary vector entry on initial stack */ __ElfType(Auxinfo); +/* + * Types of dynamic symbol hash table bucket and chain elements. + * + * This is inconsistent among 64 bit architectures, so a machine dependent + * typedef is required. + */ + +typedef Elf64_Off Elf64_Hashelt; + +__ElfType(Hashelt); + /* Values for a_type. */ #define AT_NULL 0 /* Terminates the vector. */ #define AT_IGNORE 1 /* Ignored entry. */ diff --git a/sys/amd64/include/elf.h b/sys/amd64/include/elf.h index 314dd9ce0699..eb411d85fc00 100644 --- a/sys/amd64/include/elf.h +++ b/sys/amd64/include/elf.h @@ -60,6 +60,17 @@ typedef struct { /* Auxiliary vector entry on initial stack */ __ElfType(Auxinfo); +/* + * Types of dynamic symbol hash table bucket and chain elements. + * + * This is inconsistent among 64 bit architectures, so a machine dependent + * typedef is required. + */ + +typedef Elf32_Off Elf32_Hashelt; + +__ElfType(Hashelt); + /* Values for a_type. */ #define AT_NULL 0 /* Terminates the vector. */ #define AT_IGNORE 1 /* Ignored entry. */ diff --git a/sys/i386/include/elf.h b/sys/i386/include/elf.h index 314dd9ce0699..eb411d85fc00 100644 --- a/sys/i386/include/elf.h +++ b/sys/i386/include/elf.h @@ -60,6 +60,17 @@ typedef struct { /* Auxiliary vector entry on initial stack */ __ElfType(Auxinfo); +/* + * Types of dynamic symbol hash table bucket and chain elements. + * + * This is inconsistent among 64 bit architectures, so a machine dependent + * typedef is required. + */ + +typedef Elf32_Off Elf32_Hashelt; + +__ElfType(Hashelt); + /* Values for a_type. */ #define AT_NULL 0 /* Terminates the vector. */ #define AT_IGNORE 1 /* Ignored entry. */ diff --git a/sys/ia64/include/elf.h b/sys/ia64/include/elf.h index db8bbcddcb00..a35b156c6e00 100644 --- a/sys/ia64/include/elf.h +++ b/sys/ia64/include/elf.h @@ -60,6 +60,17 @@ typedef struct { /* Auxiliary vector entry on initial stack */ __ElfType(Auxinfo); +/* + * Types of dynamic symbol hash table bucket and chain elements. + * + * This is inconsistent among 64 bit architectures, so a machine dependent + * typedef is required. + */ + +typedef Elf64_Off Elf64_Hashelt; + +__ElfType(Hashelt); + /* Values for a_type. */ #define AT_NULL 0 /* Terminates the vector. */ #define AT_IGNORE 1 /* Ignored entry. */ diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 439b9deca9a7..faaf160ee77a 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -67,10 +67,10 @@ typedef struct elf_file { vm_object_t object; /* VM object to hold file pages */ #endif Elf_Dyn* dynamic; /* Symbol table etc. */ - Elf_Off nbuckets; /* DT_HASH info */ - Elf_Off nchains; - const Elf_Off* buckets; - const Elf_Off* chains; + Elf_Hashelt nbuckets; /* DT_HASH info */ + Elf_Hashelt nchains; + const Elf_Hashelt* buckets; + const Elf_Hashelt* chains; caddr_t hash; caddr_t strtab; /* DT_STRTAB */ int strsz; /* DT_STRSZ */ @@ -299,7 +299,7 @@ parse_dynamic(elf_file_t ef) case DT_HASH: { /* From src/libexec/rtld-elf/rtld.c */ - const Elf_Off *hashtab = (const Elf_Off *) + const Elf_Hashelt *hashtab = (const Elf_Hashelt *) (ef->address + dp->d_un.d_ptr); ef->nbuckets = hashtab[0]; ef->nchains = hashtab[1]; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 439b9deca9a7..faaf160ee77a 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -67,10 +67,10 @@ typedef struct elf_file { vm_object_t object; /* VM object to hold file pages */ #endif Elf_Dyn* dynamic; /* Symbol table etc. */ - Elf_Off nbuckets; /* DT_HASH info */ - Elf_Off nchains; - const Elf_Off* buckets; - const Elf_Off* chains; + Elf_Hashelt nbuckets; /* DT_HASH info */ + Elf_Hashelt nchains; + const Elf_Hashelt* buckets; + const Elf_Hashelt* chains; caddr_t hash; caddr_t strtab; /* DT_STRTAB */ int strsz; /* DT_STRSZ */ @@ -299,7 +299,7 @@ parse_dynamic(elf_file_t ef) case DT_HASH: { /* From src/libexec/rtld-elf/rtld.c */ - const Elf_Off *hashtab = (const Elf_Off *) + const Elf_Hashelt *hashtab = (const Elf_Hashelt *) (ef->address + dp->d_un.d_ptr); ef->nbuckets = hashtab[0]; ef->nchains = hashtab[1]; diff --git a/sys/powerpc/include/elf.h b/sys/powerpc/include/elf.h index c10dfb46a6ea..81c748caf6b9 100644 --- a/sys/powerpc/include/elf.h +++ b/sys/powerpc/include/elf.h @@ -63,6 +63,17 @@ typedef struct { /* Auxiliary vector entry on initial stack */ __ElfType(Auxinfo); +/* + * Types of dynamic symbol hash table bucket and chain elements. + * + * This is inconsistent among 64 bit architectures, so a machine dependent + * typedef is required. + */ + +typedef Elf32_Off Elf32_Hashelt; + +__ElfType(Hashelt); + /* Values for a_type. */ #define AT_NULL 0 /* Terminates the vector. */ #define AT_IGNORE 1 /* Ignored entry. */