From 4648abf34c6553cd0279cfaac35eb1989d4ec7af Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 1 Apr 2009 17:52:31 -0700 Subject: [PATCH] AMD64 - Minor rtld syncs from FreeBSD Mainly change Elf_Word to Elf_Size in _rtld_bind(), plus some other minor updates. Taken-from: FreeBSD --- libexec/rtld-elf/rtld.c | 3 ++- libexec/rtld-elf/rtld.h | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 06ec1e7f13..a22845488b 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -542,7 +542,7 @@ _rtld_call_init(void) } Elf_Addr -_rtld_bind(Obj_Entry *obj, Elf_Word reloff, void *stack) +_rtld_bind(Obj_Entry *obj, Elf_Size reloff, void *stack) { const Elf_Rel *rel; const Elf_Sym *def; @@ -1142,6 +1142,7 @@ init_rtld(caddr_t mapbase) * The "path" member can't be initialized yet because string constatns * cannot yet be acessed. Below we will set it correctly. */ + memset(&objtmp, 0, sizeof(objtmp)); objtmp.path = NULL; objtmp.rtld = true; objtmp.mapbase = mapbase; diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 6f145dd4f8..594965de82 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -57,8 +57,6 @@ extern size_t tls_static_space; extern int tls_dtv_generation; extern int tls_max_index; -extern Elf_Addr _GLOBAL_OFFSET_TABLE_[]; - struct stat; struct Struct_Obj_Entry; @@ -112,8 +110,8 @@ typedef struct Struct_Obj_Entry { * These two items have to be set right for compatibility with the * original ElfKit crt1.o. */ - Elf_Word magic; /* Magic number (sanity check) */ - Elf_Word version; /* Version number of struct format */ + Elf_Size magic; /* Magic number (sanity check) */ + Elf_Size version; /* Version number of struct format */ struct Struct_Obj_Entry *next; char *path; /* Pathname of underlying file (%) */ @@ -208,6 +206,8 @@ void dump_obj_relocations(Obj_Entry *); void dump_Elf_Rel(Obj_Entry *, const Elf_Rel *, u_long); void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_long); +extern Elf_Addr _GLOBAL_OFFSET_TABLE_[]; + /* * Function declarations. */ -- 2.41.0