Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Introduce a new type Elf_Symindx for use in decoding the sym...
details: https://anonhg.NetBSD.org/src/rev/4b76bcabdfdd
branches: trunk
changeset: 757869:4b76bcabdfdd
user: skrll <skrll%NetBSD.org@localhost>
date: Thu Sep 30 09:11:18 2010 +0000
description:
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.
diffstat:
libexec/ld.elf_so/arch/alpha/alpha_reloc.c | 8 ++++----
libexec/ld.elf_so/headers.c | 8 ++++----
libexec/ld.elf_so/rtld.h | 6 +++---
sys/arch/alpha/include/elf_machdep.h | 11 ++++-------
sys/sys/exec_elf.h | 10 +++++-----
5 files changed, 20 insertions(+), 23 deletions(-)
diffs (148 lines):
diff -r 62d501cb9e66 -r 4b76bcabdfdd libexec/ld.elf_so/arch/alpha/alpha_reloc.c
--- a/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Thu Sep 30 03:16:51 2010 +0000
+++ b/libexec/ld.elf_so/arch/alpha/alpha_reloc.c Thu Sep 30 09:11:18 2010 +0000
@@ -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);
diff -r 62d501cb9e66 -r 4b76bcabdfdd libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c Thu Sep 30 03:16:51 2010 +0000
+++ b/libexec/ld.elf_so/headers.c Thu Sep 30 09:11:18 2010 +0000
@@ -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;
diff -r 62d501cb9e66 -r 4b76bcabdfdd libexec/ld.elf_so/rtld.h
--- a/libexec/ld.elf_so/rtld.h Thu Sep 30 03:16:51 2010 +0000
+++ b/libexec/ld.elf_so/rtld.h Thu Sep 30 09:11:18 2010 +0000
@@ -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 */
diff -r 62d501cb9e66 -r 4b76bcabdfdd sys/arch/alpha/include/elf_machdep.h
--- a/sys/arch/alpha/include/elf_machdep.h Thu Sep 30 03:16:51 2010 +0000
+++ b/sys/arch/alpha/include/elf_machdep.h Thu Sep 30 09:11:18 2010 +0000
@@ -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 \
diff -r 62d501cb9e66 -r 4b76bcabdfdd sys/sys/exec_elf.h
--- a/sys/sys/exec_elf.h Thu Sep 30 03:16:51 2010 +0000
+++ b/sys/sys/exec_elf.h Thu Sep 30 09:11:18 2010 +0000
@@ -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)
Home |
Main Index |
Thread Index |
Old Index