Module Name: src
Committed By: skrll
Date: Thu Sep 30 09:11:19 UTC 2010
Modified Files:
src/libexec/ld.elf_so: headers.c rtld.h
src/libexec/ld.elf_so/arch/alpha: alpha_reloc.c
src/sys/arch/alpha/include: elf_machdep.h
src/sys/sys: exec_elf.h
Log Message:
Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.
The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.
Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.
Fixes ld.elf_so after Herculean effort from me and martin.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/libexec/ld.elf_so/headers.c
cvs rdiff -u -r1.92 -r1.93 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.37 -r1.38 src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/include/elf_machdep.h
cvs rdiff -u -r1.103 -r1.104 src/sys/sys/exec_elf.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.30 src/libexec/ld.elf_so/headers.c:1.31
--- src/libexec/ld.elf_so/headers.c:1.30 Thu Sep 23 13:03:35 2010
+++ src/libexec/ld.elf_so/headers.c Thu Sep 30 09:11:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: headers.c,v 1.30 2010/09/23 13:03:35 joerg Exp $ */
+/* $NetBSD: headers.c,v 1.31 2010/09/30 09:11:18 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.30 2010/09/23 13:03:35 joerg Exp $");
+__RCSID("$NetBSD: headers.c,v 1.31 2010/09/30 09:11:18 skrll Exp $");
#endif /* not lint */
#include <err.h>
@@ -138,8 +138,8 @@
case DT_HASH:
{
- const Elf_Word *hashtab = (const Elf_Word *)
- (obj->relocbase + dynp->d_un.d_ptr);
+ const Elf_Symindx *hashtab = (const Elf_Symindx *)
+ (obj->relocbase + dynp->d_un.d_ptr);
if (hashtab[0] > UINT32_MAX)
obj->nbuckets = UINT32_MAX;
Index: src/libexec/ld.elf_so/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.92 src/libexec/ld.elf_so/rtld.h:1.93
--- src/libexec/ld.elf_so/rtld.h:1.92 Fri Aug 6 16:33:17 2010
+++ src/libexec/ld.elf_so/rtld.h Thu Sep 30 09:11:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.h,v 1.92 2010/08/06 16:33:17 joerg Exp $ */
+/* $NetBSD: rtld.h,v 1.93 2010/09/30 09:11:18 skrll Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -161,12 +161,12 @@
Elf_Word gotsym; /* First dynamic symbol in GOT */
#endif
- const Elf_Word *buckets; /* Hash table buckets array */
+ const Elf_Symindx *buckets; /* Hash table buckets array */
uint32_t nbuckets; /* Number of buckets */
uint32_t nbuckets_m; /* Precomputed for fast remainder */
uint8_t nbuckets_s1;
uint8_t nbuckets_s2;
- const Elf_Word *chains; /* Hash table chain array */
+ const Elf_Symindx *chains; /* Hash table chain array */
unsigned long nchains; /* Number of chains */
Search_Path *rpaths; /* Search path specified in object */
Index: src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c
diff -u src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c:1.37 src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c:1.38
--- src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c:1.37 Fri Aug 6 16:33:17 2010
+++ src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Thu Sep 30 09:11:18 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_reloc.c,v 1.37 2010/08/06 16:33:17 joerg Exp $ */
+/* $NetBSD: alpha_reloc.c,v 1.38 2010/09/30 09:11:18 skrll Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: alpha_reloc.c,v 1.37 2010/08/06 16:33:17 joerg Exp $");
+__RCSID("$NetBSD: alpha_reloc.c,v 1.38 2010/09/30 09:11:18 skrll Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -80,7 +80,7 @@
void _rtld_bind_start(void);
void _rtld_bind_start_old(void);
void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr);
-caddr_t _rtld_bind(const Obj_Entry *, Elf_Word);
+caddr_t _rtld_bind(const Obj_Entry *, Elf_Addr);
static inline int _rtld_relocate_plt_object(const Obj_Entry *,
const Elf_Rela *, Elf_Addr *);
@@ -476,7 +476,7 @@
}
caddr_t
-_rtld_bind(const Obj_Entry *obj, Elf_Word reloff)
+_rtld_bind(const Obj_Entry *obj, Elf_Addr reloff)
{
const Elf_Rela *rela =
(const Elf_Rela *)((const uint8_t *)obj->pltrela + reloff);
Index: src/sys/arch/alpha/include/elf_machdep.h
diff -u src/sys/arch/alpha/include/elf_machdep.h:1.11 src/sys/arch/alpha/include/elf_machdep.h:1.12
--- src/sys/arch/alpha/include/elf_machdep.h:1.11 Sat May 30 05:56:52 2009
+++ src/sys/arch/alpha/include/elf_machdep.h Thu Sep 30 09:11:19 2010
@@ -1,16 +1,13 @@
-/* $NetBSD: elf_machdep.h,v 1.11 2009/05/30 05:56:52 skrll Exp $ */
+/* $NetBSD: elf_machdep.h,v 1.12 2010/09/30 09:11:19 skrll Exp $ */
#ifndef _ALPHA_ELF_MACHDEP_H_
#define _ALPHA_ELF_MACHDEP_H_
/*
- * Alpha ELF uses different (non-standard) definitions of Elf64_Sword
- * and Elf64_Word.
+ * Alpha ELF uses different (non-standard) definitions for the symbol
+ * hash table section.
*/
-typedef int64_t Elf64_Sword;
-#define ELF64_FSZ_SWORD 8
-typedef uint64_t Elf64_Word;
-#define ELF64_FSZ_WORD 8
+#define Elf_Symindx uint64_t
#define ELF32_MACHDEP_ENDIANNESS XXX /* break compilation */
#define ELF32_MACHDEP_ID_CASES \
Index: src/sys/sys/exec_elf.h
diff -u src/sys/sys/exec_elf.h:1.103 src/sys/sys/exec_elf.h:1.104
--- src/sys/sys/exec_elf.h:1.103 Sat Aug 28 21:30:02 2010
+++ src/sys/sys/exec_elf.h Thu Sep 30 09:11:19 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.h,v 1.103 2010/08/28 21:30:02 joerg Exp $ */
+/* $NetBSD: exec_elf.h,v 1.104 2010/09/30 09:11:19 skrll Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -84,14 +84,10 @@
typedef int32_t Elf64_Shalf;
#define ELF64_FSZ_SHALF 4
-#ifndef ELF64_FSZ_SWORD
typedef int32_t Elf64_Sword;
#define ELF64_FSZ_SWORD 4
-#endif /* ELF64_FSZ_SWORD */
-#ifndef ELF64_FSZ_WORD
typedef uint32_t Elf64_Word;
#define ELF64_FSZ_WORD 4
-#endif /* ELF64_FSZ_WORD */
typedef int64_t Elf64_Sxword;
#define ELF64_FSZ_SXWORD 8
@@ -887,6 +883,10 @@
#define AuxInfo Aux64Info
#endif
+#ifndef Elf_Symindx
+#define Elf_Symindx uint32_t
+#endif
+
#define ELF32_ST_BIND(info) ELF_ST_BIND(info)
#define ELF32_ST_TYPE(info) ELF_ST_TYPE(info)
#define ELF32_ST_INFO(bind,type) ELF_ST_INFO(bind,type)