summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/include/dl-elf.h10
-rw-r--r--ldso/include/ld_elf.h10
-rw-r--r--ldso/ldso/arm/elfinterp.c68
-rw-r--r--ldso/ldso/cris/elfinterp.c43
-rw-r--r--ldso/ldso/dl-elf.c6
-rw-r--r--ldso/ldso/i386/elfinterp.c57
-rw-r--r--ldso/ldso/m68k/elfinterp.c23
-rw-r--r--ldso/ldso/mips/elfinterp.c29
-rw-r--r--ldso/ldso/powerpc/elfinterp.c57
-rw-r--r--ldso/ldso/readelflib1.c6
-rw-r--r--ldso/ldso/sh/elfinterp.c72
-rw-r--r--ldso/ldso/sh64/elfinterp.c66
-rw-r--r--ldso/ldso/sparc/elfinterp.c48
13 files changed, 245 insertions, 250 deletions
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index 4a1488432..34a3c62ad 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -54,19 +54,19 @@ typedef struct {
#else
static inline void _dl_map_cache(void) { }
static inline void _dl_unmap_cache(void) { }
-#endif
+#endif
/* Function prototypes for non-static stuff in readelflib1.c */
extern int _dl_parse_copy_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type);
-extern void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+extern void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type);
-extern int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+extern int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type);
-extern struct elf_resolve * _dl_load_shared_library(int secure,
+extern struct elf_resolve * _dl_load_shared_library(int secure,
struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname);
-extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
+extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
struct dyn_elf **rpnt, char *libname);
extern struct elf_resolve *_dl_check_if_named_library_is_loaded(const char *full_libname);
extern int _dl_linux_resolve(void);
diff --git a/ldso/include/ld_elf.h b/ldso/include/ld_elf.h
index 4a1488432..34a3c62ad 100644
--- a/ldso/include/ld_elf.h
+++ b/ldso/include/ld_elf.h
@@ -54,19 +54,19 @@ typedef struct {
#else
static inline void _dl_map_cache(void) { }
static inline void _dl_unmap_cache(void) { }
-#endif
+#endif
/* Function prototypes for non-static stuff in readelflib1.c */
extern int _dl_parse_copy_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type);
-extern void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+extern void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type);
-extern int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+extern int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type);
-extern struct elf_resolve * _dl_load_shared_library(int secure,
+extern struct elf_resolve * _dl_load_shared_library(int secure,
struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname);
-extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
+extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
struct dyn_elf **rpnt, char *libname);
extern struct elf_resolve *_dl_check_if_named_library_is_loaded(const char *full_libname);
extern int _dl_linux_resolve(void);
diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c
index 6c908a671..4af05354d 100644
--- a/ldso/ldso/arm/elfinterp.c
+++ b/ldso/ldso/arm/elfinterp.c
@@ -1,7 +1,7 @@
/* vi: set sw=4 ts=4: */
/* ARM ELF shared library loader suppport
*
- * Copyright (C) 2001-2002, Erik Andersen
+ * Copyright (C) 2001-2004 Erik Andersen
*
* All rights reserved.
*
@@ -47,9 +47,9 @@ static const char *_dl_reltypes_tab[] =
static const char *
_dl_reltypes(int type)
{
- static char buf[22];
+ static char buf[22];
const char *str;
-
+
if (type >= (sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
NULL == (str = _dl_reltypes_tab[type]))
{
@@ -58,7 +58,7 @@ _dl_reltypes(int type)
return str;
}
-static
+static
void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
if(_dl_debug_symbols)
@@ -83,7 +83,7 @@ static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
const char *sym;
symtab_index = ELF32_R_SYM(rpnt->r_info);
sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
+
#ifdef ELF_USES_RELOCA
_dl_dprintf(_dl_debug_file, "\n%s\toffset=%x\taddend=%x %s",
_dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
@@ -136,21 +136,21 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
if (reloc_type != R_ARM_JUMP_SLOT) {
- _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
+ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
_dl_progname);
_dl_exit(1);
};
/* Address of jump instruction to fix up */
- instr_addr = ((unsigned long) this_reloc->r_offset +
+ instr_addr = ((unsigned long) this_reloc->r_offset +
(unsigned long) tpnt->loadaddr);
got_addr = (char **) instr_addr;
/* Get the address of the GOT entry */
- new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name,
+ new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name,
tpnt->symbol_scope, tpnt, resolver);
if (!new_addr) {
- _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
+ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
_dl_progname, strtab + symtab[symtab_index].st_name);
_dl_exit(1);
};
@@ -161,7 +161,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s",
strtab + symtab[symtab_index].st_name);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
}
}
@@ -197,9 +197,9 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
-
+
symtab_index = ELF32_R_SYM(rpnt->r_info);
-
+
/* When the dynamic linker bootstrapped itself, it resolved some symbols.
Make sure we do not do them again */
if (!symtab_index && tpnt->libtype == program_interpreter)
@@ -218,10 +218,10 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
if (res==0) continue;
_dl_dprintf(2, "\n%s: ",_dl_progname);
-
+
if (symtab_index)
_dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-
+
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
@@ -229,7 +229,7 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-#endif
+#endif
_dl_exit(-res);
}
else if (res >0)
@@ -282,7 +282,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
if (symtab_index) {
- symbol_addr = (unsigned long) _dl_find_hash(strtab + symtab[symtab_index].st_name,
+ symbol_addr = (unsigned long) _dl_find_hash(strtab + symtab[symtab_index].st_name,
scope, (reloc_type == R_ARM_JUMP_SLOT ? tpnt : NULL), symbolrel);
/*
@@ -322,7 +322,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
topbits = newvalue & 0xfe000000;
if (topbits != 0xfe000000 && topbits != 0x00000000)
{
- _dl_dprintf(2,"symbol '%s': R_ARM_PC24 relocation out of range.",
+ _dl_dprintf(2,"symbol '%s': R_ARM_PC24 relocation out of range.",
symtab[symtab_index].st_name);
_dl_exit(1);
}
@@ -339,13 +339,13 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
case R_ARM_RELATIVE:
*reloc_addr += (unsigned long) tpnt->loadaddr;
break;
- case R_ARM_COPY:
-#if 0
+ case R_ARM_COPY:
+#if 0
/* Do this later */
_dl_dprintf(2, "Doing copy for symbol ");
if (symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name);
_dl_dprintf(2, "\n");
- _dl_memcpy((void *) symtab[symtab_index].st_value,
+ _dl_memcpy((void *) symtab[symtab_index].st_value,
(void *) symbol_addr, symtab[symtab_index].st_size);
#endif
break;
@@ -404,7 +404,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
/* No, there are cases where the SVr4 linker fails to emit COPY relocs
at all */
static int
-_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
+_dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
{
int reloc_type;
@@ -412,18 +412,18 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long *reloc_addr;
unsigned long symbol_addr;
int goof = 0;
-
+
reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- if (reloc_type != R_ARM_COPY)
+ if (reloc_type != R_ARM_COPY)
return 0;
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
-
+
if (symtab_index) {
- symbol_addr = (unsigned long) _dl_find_hash(strtab +
- symtab[symtab_index].st_name, scope,
+ symbol_addr = (unsigned long) _dl_find_hash(strtab +
+ symtab[symtab_index].st_name, scope,
NULL, copyrel);
if (!symbol_addr) goof++;
}
@@ -435,28 +435,28 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
symtab[symtab_index].st_size,
symbol_addr, symtab[symtab_index].st_value);
#endif
- _dl_memcpy((char *) symtab[symtab_index].st_value,
+ _dl_memcpy((char *) symtab[symtab_index].st_value,
(char *) symbol_addr, symtab[symtab_index].st_size);
}
return goof;
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+ (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
}
-int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
}
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy);
+ return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
}
diff --git a/ldso/ldso/cris/elfinterp.c b/ldso/ldso/cris/elfinterp.c
index 8a19fcd69..71e1ff7d3 100644
--- a/ldso/ldso/cris/elfinterp.c
+++ b/ldso/ldso/cris/elfinterp.c
@@ -54,16 +54,16 @@ _dl_reltypes(int type)
if (type >= (sizeof(_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
NULL == (str = _dl_reltypes_tab[type]))
str = _dl_simple_ltoa(buf, (unsigned long) (type));
-
+
return str;
}
-static void
+static void
debug_sym(Elf32_Sym *symtab, char *strtab, int symtab_index)
-{
- if (_dl_debug_symbols) {
+{
+ if (_dl_debug_symbols) {
if (symtab_index) {
- _dl_dprintf(_dl_debug_file,
+ _dl_dprintf(_dl_debug_file,
"\n%s\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
strtab + symtab[symtab_index].st_name,
symtab[symtab_index].st_value,
@@ -157,7 +157,7 @@ _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
#if defined (__SUPPORT_LD_DEBUG__)
if (_dl_debug_bindings) {
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
-
+
if (_dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
}
@@ -169,7 +169,7 @@ _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
static int
_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, unsigned long rel_addr,
- unsigned long rel_size, int (*reloc_fnc)(struct elf_resolve *tpnt, struct dyn_elf *scope,
+ unsigned long rel_size, int (*reloc_fnc)(struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab))
{
int symtab_index;
@@ -189,7 +189,7 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, unsigned long rel_add
for (i = 0; i < rel_size; i++, rpnt++) {
symtab_index = ELF32_R_SYM(rpnt->r_info);
- /*
+ /*
* Make sure the same symbols that the linker resolved when it
* bootstapped itself isn't resolved again.
*/
@@ -255,7 +255,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rpnt,
symname = strtab + symtab[symtab_index].st_name;
if (symtab_index) {
- if (symtab[symtab_index].st_shndx != SHN_UNDEF &&
+ if (symtab[symtab_index].st_shndx != SHN_UNDEF &&
ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_LOCAL) {
symbol_addr = (unsigned long) tpnt->loadaddr;
}
@@ -359,7 +359,7 @@ _dl_do_copy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rp
if (reloc_type != R_CRIS_COPY)
return 0;
-
+
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
symname = strtab + symtab[symtab_index].st_name;
@@ -387,28 +387,27 @@ _dl_do_copy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, ELF_RELOC *rp
/* External interface to the generic part of the dynamic linker. */
-int
-_dl_parse_relocation_information(struct elf_resolve *tpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
/* Keep the compiler happy. */
(void) type;
- return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
+ (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
}
-void
-_dl_parse_lazy_relocation_information(struct elf_resolve *tpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
/* Keep the compiler happy. */
(void) type;
- _dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
}
-int
-_dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
/* Keep the compiler happy. */
(void) type;
- return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
}
+
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 4b6d75d7a..4324aed01 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -892,7 +892,7 @@ int _dl_fixup(struct dyn_elf *rpnt, int flag)
if (tpnt->init_flag & RELOCS_DONE)
return goof;
tpnt->init_flag |= RELOCS_DONE;
- goof += _dl_parse_relocation_information(tpnt,
+ goof += _dl_parse_relocation_information(rpnt,
tpnt->dynamic_info[DT_RELOC_TABLE_ADDR],
tpnt->dynamic_info[DT_RELOC_TABLE_SIZE], 0);
}
@@ -902,11 +902,11 @@ int _dl_fixup(struct dyn_elf *rpnt, int flag)
return goof;
tpnt->init_flag |= JMP_RELOCS_DONE;
if (flag & RTLD_LAZY) {
- _dl_parse_lazy_relocation_information(tpnt,
+ _dl_parse_lazy_relocation_information(rpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info [DT_PLTRELSZ], 0);
} else {
- goof += _dl_parse_relocation_information(tpnt,
+ goof += _dl_parse_relocation_information(rpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
}
diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c
index 5ccad3259..5681d2e41 100644
--- a/ldso/ldso/i386/elfinterp.c
+++ b/ldso/ldso/i386/elfinterp.c
@@ -1,9 +1,9 @@
/* vi: set sw=4 ts=4: */
/* i386 ELF shared library loader suppport
*
- * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
* David Engel, Hongjiu Lu and Mitch D'Souza
- * Copyright (C) 2001-2002, Erik Andersen
+ * Copyright (C) 2001-2004 Erik Andersen
*
* All rights reserved.
*
@@ -40,9 +40,9 @@ static const char *_dl_reltypes_tab[] =
static const char *
_dl_reltypes(int type)
{
- static char buf[22];
+ static char buf[22];
const char *str;
-
+
if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
NULL == (str = _dl_reltypes_tab[type]))
{
@@ -51,7 +51,7 @@ _dl_reltypes(int type)
return str;
}
-static
+static
void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
if(_dl_debug_symbols)
@@ -76,7 +76,7 @@ static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
const char *sym;
symtab_index = ELF32_R_SYM(rpnt->r_info);
sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
+
if(_dl_debug_symbols)
_dl_dprintf(_dl_debug_file, "\n\t");
else
@@ -132,13 +132,13 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
symname= strtab + symtab[symtab_index].st_name;
if (reloc_type != R_386_JMP_SLOT) {
- _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
+ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
_dl_progname);
_dl_exit(1);
}
/* Address of jump instruction to fix up */
- instr_addr = ((unsigned long) this_reloc->r_offset +
+ instr_addr = ((unsigned long) this_reloc->r_offset +
(unsigned long) tpnt->loadaddr);
got_addr = (char **) instr_addr;
@@ -159,7 +159,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
if (_dl_debug_bindings)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr);
}
}
@@ -194,9 +194,9 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
-
+
symtab_index = ELF32_R_SYM(rpnt->r_info);
-
+
/* When the dynamic linker bootstrapped itself, it resolved some symbols.
Make sure we do not do them again */
if (!symtab_index && tpnt->libtype == program_interpreter)
@@ -215,10 +215,10 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
if (res==0) continue;
_dl_dprintf(2, "\n%s: ",_dl_progname);
-
+
if (symtab_index)
_dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-
+
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
@@ -226,7 +226,7 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-#endif
+#endif
_dl_exit(-res);
}
else if (res >0)
@@ -260,7 +260,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
if (symtab_index) {
- symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
+ symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
(reloc_type == R_386_JMP_SLOT ? tpnt : NULL), symbolrel);
/*
@@ -356,7 +356,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
/* No, there are cases where the SVr4 linker fails to emit COPY relocs
at all */
static int
-_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
+_dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
{
int reloc_type;
@@ -365,15 +365,15 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long symbol_addr;
int goof = 0;
char *symname;
-
+
reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- if (reloc_type != R_386_COPY)
+ if (reloc_type != R_386_COPY)
return 0;
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
symname = strtab + symtab[symtab_index].st_name;
-
+
if (symtab_index) {
symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel);
if (!symbol_addr) goof++;
@@ -385,31 +385,28 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
symname, symtab[symtab_index].st_size,
symbol_addr, symtab[symtab_index].st_value);
#endif
- _dl_memcpy((char *) symtab[symtab_index].st_value,
+ _dl_memcpy((char *) symtab[symtab_index].st_value,
(char *) symbol_addr, symtab[symtab_index].st_size);
}
return goof;
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+ (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
}
-int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
}
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy);
+ return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
}
diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c
index 0531b17f9..1bcbec389 100644
--- a/ldso/ldso/m68k/elfinterp.c
+++ b/ldso/ldso/m68k/elfinterp.c
@@ -1,7 +1,7 @@
/* vi: set sw=4 ts=4: */
/* m68k ELF shared library loader suppport
*
- * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
* David Engel, Hongjiu Lu and Mitch D'Souza
* Adapted to ELF/68k by Andreas Schwab.
*
@@ -56,7 +56,7 @@ static const char *_dl_reltypes[] =
working. */
-unsigned int _dl_linux_resolver (int dummy1, int dummy2,
+unsigned int _dl_linux_resolver (int dummy1, int dummy2,
struct elf_resolve *tpnt, int reloc_entry)
{
int reloc_type;
@@ -112,7 +112,7 @@ unsigned int _dl_linux_resolver (int dummy1, int dummy2,
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s",
strtab + symtab[symtab_index].st_name);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
}
}
@@ -126,9 +126,8 @@ unsigned int _dl_linux_resolver (int dummy1, int dummy2,
return (unsigned int) new_addr;
}
-void
-_dl_parse_lazy_relocation_information (struct elf_resolve *tpnt,
- unsigned long rel_addr, unsigned long rel_size, int type)
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
int i;
char *strtab;
@@ -137,6 +136,7 @@ _dl_parse_lazy_relocation_information (struct elf_resolve *tpnt,
Elf32_Sym *symtab;
Elf32_Rela *rpnt;
unsigned int *reloc_addr;
+ struct elf_resolve *tpnt = rpnt->dyn;
/* Now parse the relocation information. */
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
@@ -179,9 +179,8 @@ _dl_parse_lazy_relocation_information (struct elf_resolve *tpnt,
}
}
-int
-_dl_parse_relocation_information (struct elf_resolve *tpnt,
- unsigned long rel_addr, unsigned long rel_size, int type)
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
int i;
char *strtab;
@@ -192,6 +191,7 @@ _dl_parse_relocation_information (struct elf_resolve *tpnt,
unsigned int *reloc_addr;
unsigned int symbol_addr;
int symtab_index;
+ struct elf_resolve *tpnt = rpnt->dyn;
/* Now parse the relocation information */
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
@@ -302,9 +302,8 @@ _dl_parse_relocation_information (struct elf_resolve *tpnt,
/* No, there are cases where the SVr4 linker fails to emit COPY relocs
at all. */
-int
-_dl_parse_copy_information (struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *xpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
int i;
char *strtab;
diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
index a73a89a60..9f1e6839e 100644
--- a/ldso/ldso/mips/elfinterp.c
+++ b/ldso/ldso/mips/elfinterp.c
@@ -48,9 +48,9 @@ static const char *_dl_reltypes_tab[] =
static const char *
_dl_reltypes(int type)
{
- static char buf[22];
+ static char buf[22];
const char *str;
-
+
if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
NULL == (str = _dl_reltypes_tab[type]))
{
@@ -59,7 +59,7 @@ _dl_reltypes(int type)
return str;
}
-static
+static
void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
if(_dl_debug_symbols)
@@ -84,7 +84,7 @@ static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
const char *sym;
symtab_index = ELF32_R_SYM(rpnt->r_info);
sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
+
if(_dl_debug_symbols)
_dl_dprintf(_dl_debug_file, "\n\t");
else
@@ -130,16 +130,16 @@ unsigned long _dl_linux_resolver(unsigned long sym_index,
new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name,
tpnt->symbol_scope, tpnt, resolver);
-
+
/* Address of jump instruction to fix up */
- instr_addr = (unsigned long) (got + local_gotno + sym_index - gotsym);
+ instr_addr = (unsigned long) (got + local_gotno + sym_index - gotsym);
got_addr = (char **) instr_addr;
-
+
#if defined (__SUPPORT_LD_DEBUG__)
if (_dl_debug_bindings)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr);
}
if (!_dl_debug_nofixups) {
@@ -152,22 +152,22 @@ unsigned long _dl_linux_resolver(unsigned long sym_index,
return new_addr;
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
/* Nothing to do */
- return;
+ return 0;
}
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
/* Nothing to do */
return 0;
}
-int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
Elf32_Sym *symtab;
@@ -177,6 +177,7 @@ int _dl_parse_relocation_information(struct elf_resolve *tpnt,
unsigned long *reloc_addr=NULL, old_val=0;
unsigned long symbol_addr;
int i, reloc_type, symtab_index;
+ struct elf_resolve *tpnt = rpnt->dyn;
/* Now parse the relocation information */
rel_size = rel_size / sizeof(Elf32_Rel);
@@ -232,7 +233,7 @@ int _dl_parse_relocation_information(struct elf_resolve *tpnt,
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-#endif
+#endif
_dl_exit(1);
}
};
diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c
index eec78e305..635296142 100644
--- a/ldso/ldso/powerpc/elfinterp.c
+++ b/ldso/ldso/powerpc/elfinterp.c
@@ -1,8 +1,8 @@
/* vi: set sw=4 ts=4: */
/* powerpc shared library loader suppport
*
- * Copyright (C) 2001-2002, David A. Schleef
- * Copyright (C) 2003, Erik Andersen
+ * Copyright (C) 2001-2002 David A. Schleef
+ * Copyright (C) 2003-2004 Erik Andersen
*
* All rights reserved.
*
@@ -46,9 +46,9 @@ static const char *_dl_reltypes_tab[] =
static const char *
_dl_reltypes(int type)
{
- static char buf[22];
+ static char buf[22];
const char *str;
-
+
if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
NULL == (str = _dl_reltypes_tab[type]))
{
@@ -57,7 +57,7 @@ _dl_reltypes(int type)
return str;
}
-static
+static
void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
if(_dl_debug_symbols)
@@ -74,7 +74,7 @@ void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
}
}
-static
+static
void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
{
if(_dl_debug_reloc)
@@ -83,7 +83,7 @@ void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
const char *sym;
symtab_index = ELF32_R_SYM(rpnt->r_info);
sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
+
if(_dl_debug_symbols)
_dl_dprintf(_dl_debug_file, "\n\t");
else
@@ -208,7 +208,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
#endif
/* Get the address of the GOT entry */
- finaladdr = (Elf32_Addr) _dl_find_hash(strtab + symtab[symtab_index].st_name,
+ finaladdr = (Elf32_Addr) _dl_find_hash(strtab + symtab[symtab_index].st_name,
tpnt->symbol_scope, tpnt, resolver);
if (!finaladdr) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
@@ -272,9 +272,9 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
-
+
symtab_index = ELF32_R_SYM(rpnt->r_info);
-
+
/* When the dynamic linker bootstrapped itself, it resolved some symbols.
Make sure we do not do them again */
if (!symtab_index && tpnt->libtype == program_interpreter)
@@ -293,10 +293,10 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
if (res==0) continue;
_dl_dprintf(2, "\n%s: ",_dl_progname);
-
+
if (symtab_index)
_dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-
+
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
@@ -304,7 +304,7 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-#endif
+#endif
_dl_exit(-res);
}
else if (res >0)
@@ -341,7 +341,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
symtab_index = ELF32_R_SYM(rpnt->r_info);
symname = strtab + symtab[symtab_index].st_name;
- symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
+ symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
(reloc_type == R_PPC_JMP_SLOT ? tpnt : NULL), symbolrel);
/*
* We want to allow undefined references to weak symbols - this might
@@ -369,7 +369,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
case R_PPC_JMP_SLOT:
{
Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
-
+
if (delta<<6>>6 == delta) {
*reloc_addr = OPCODE_B(delta);
#if 0
@@ -458,7 +458,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
a bug in the handling of _COPY by SVr4, and this may in fact be what he
was talking about. Sigh. */
static int
-_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
+_dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
{
int reloc_type;
@@ -467,15 +467,15 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long symbol_addr;
int goof = 0;
char *symname;
-
+
reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- if (reloc_type != R_PPC_COPY)
+ if (reloc_type != R_PPC_COPY)
return 0;
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
symname = strtab + symtab[symtab_index].st_name;
-
+
if (symtab_index) {
symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel);
if (!symbol_addr) goof++;
@@ -494,9 +494,10 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
return goof;
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
+ struct elf_resolve *tpnt = rpnt->dyn;
Elf32_Word *plt, offset, i, num_plt_entries, rel_offset_words;
(void) type;
@@ -525,7 +526,7 @@ void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
(In a multiprocessor system, the effect is more complex.)
Most of the PLT shouldn't be in the instruction cache, but
there may be a little overlap at the start and the end.
-
+
Assumes that dcbst and icbi apply to lines of 16 bytes or
more. Current known line sizes are 16, 32, and 128 bytes. */
for (i = 0; i < rel_offset_words; i += 4)
@@ -537,16 +538,16 @@ void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
PPC_ISYNC;
}
-int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
}
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy);
+ return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
}
+
+
diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c
index 4b6d75d7a..4324aed01 100644
--- a/ldso/ldso/readelflib1.c
+++ b/ldso/ldso/readelflib1.c
@@ -892,7 +892,7 @@ int _dl_fixup(struct dyn_elf *rpnt, int flag)
if (tpnt->init_flag & RELOCS_DONE)
return goof;
tpnt->init_flag |= RELOCS_DONE;
- goof += _dl_parse_relocation_information(tpnt,
+ goof += _dl_parse_relocation_information(rpnt,
tpnt->dynamic_info[DT_RELOC_TABLE_ADDR],
tpnt->dynamic_info[DT_RELOC_TABLE_SIZE], 0);
}
@@ -902,11 +902,11 @@ int _dl_fixup(struct dyn_elf *rpnt, int flag)
return goof;
tpnt->init_flag |= JMP_RELOCS_DONE;
if (flag & RTLD_LAZY) {
- _dl_parse_lazy_relocation_information(tpnt,
+ _dl_parse_lazy_relocation_information(rpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info [DT_PLTRELSZ], 0);
} else {
- goof += _dl_parse_relocation_information(tpnt,
+ goof += _dl_parse_relocation_information(rpnt,
tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
}
diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c
index 10973c517..a2edffea2 100644
--- a/ldso/ldso/sh/elfinterp.c
+++ b/ldso/ldso/sh/elfinterp.c
@@ -1,7 +1,7 @@
/* vi: set sw=4 ts=4: */
/* SuperH ELF shared library loader suppport
*
- * Copyright (C) 2002, Stefan Allius <allius@atecom.com> and
+ * Copyright (C) 2002, Stefan Allius <allius@atecom.com> and
* Eddie C. Dost <ecd@atecom.com>
*
* All rights reserved.
@@ -44,9 +44,9 @@ static const char *_dl_reltypes_tab[] =
static const char *
_dl_reltypes(int type)
{
- static char buf[22];
+ static char buf[22];
const char *str;
-
+
if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
NULL == (str = _dl_reltypes_tab[type]))
{
@@ -55,7 +55,7 @@ _dl_reltypes(int type)
return str;
}
-static
+static
void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
if(_dl_debug_symbols)
@@ -80,12 +80,12 @@ static void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
const char *sym;
symtab_index = ELF32_R_SYM(rpnt->r_info);
sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
-
+
if(_dl_debug_symbols)
_dl_dprintf(_dl_debug_file, "\n\t");
else
_dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
-
+
#ifdef ELF_USES_RELOCA
_dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
_dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
@@ -137,13 +137,13 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
symname = strtab + symtab[symtab_index].st_name;
if (reloc_type != R_SH_JMP_SLOT) {
- _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
+ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
_dl_progname);
_dl_exit(1);
}
-
+
/* Address of jump instruction to fix up */
- instr_addr = ((unsigned long) this_reloc->r_offset +
+ instr_addr = ((unsigned long) this_reloc->r_offset +
(unsigned long) tpnt->loadaddr);
got_addr = (char **) instr_addr;
@@ -155,7 +155,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
if (new_addr) {
return (unsigned long) new_addr;
}
-
+
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
_dl_exit(1);
}
@@ -166,7 +166,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
if (_dl_debug_bindings)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr);
}
}
@@ -202,9 +202,9 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
-
+
symtab_index = ELF32_R_SYM(rpnt->r_info);
-
+
/* When the dynamic linker bootstrapped itself, it resolved some symbols.
Make sure we do not do them again */
if (!symtab_index && tpnt->libtype == program_interpreter)
@@ -223,10 +223,10 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
if (res==0) continue;
_dl_dprintf(2, "\n%s: ",_dl_progname);
-
+
if (symtab_index)
_dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-
+
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
@@ -234,7 +234,7 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-#endif
+#endif
_dl_exit(-res);
}
else if (res >0)
@@ -259,7 +259,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
#if defined (__SUPPORT_LD_DEBUG__)
unsigned long old_val;
#endif
-
+
reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
symtab_index = ELF32_R_SYM(rpnt->r_info);
@@ -269,7 +269,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
if (symtab_index) {
- symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
+ symbol_addr = (unsigned long) _dl_find_hash(symname, scope,
(reloc_type == R_SH_JMP_SLOT ? tpnt : NULL), symbolrel);
/*
@@ -318,8 +318,8 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
return 0;
}
-
-
+
+
static int
_dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
@@ -335,7 +335,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
-
+
#if defined (__SUPPORT_LD_DEBUG__)
old_val = *reloc_addr;
#endif
@@ -353,7 +353,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
#endif
return 0;
-
+
}
/* This is done as a separate step, because there are cases where
@@ -365,7 +365,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
/* No, there are cases where the SVr4 linker fails to emit COPY relocs
at all */
static int
-_dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
+_dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
{
int reloc_type;
@@ -374,15 +374,15 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long symbol_addr;
int goof = 0;
char*symname;
-
+
reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- if (reloc_type != R_SH_COPY)
+ if (reloc_type != R_SH_COPY)
return 0;
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
symname = strtab + symtab[symtab_index].st_name;
-
+
if (symtab_index) {
symbol_addr = (unsigned long) _dl_find_hash(symname, scope, NULL, copyrel);
@@ -395,7 +395,7 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
symname, symtab[symtab_index].st_size,
symbol_addr, symtab[symtab_index].st_value);
#endif
- _dl_memcpy((char *) symtab[symtab_index].st_value,
+ _dl_memcpy((char *) symtab[symtab_index].st_value,
(char *) symbol_addr, symtab[symtab_index].st_size);
}
@@ -403,25 +403,21 @@ _dl_do_copy (struct elf_resolve *tpnt, struct dyn_elf *scope,
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- (void)_dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+ (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
}
-int _dl_parse_relocation_information(struct elf_resolve *tpnt,
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
}
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- (void) type;
- return _dl_parse(xpnt->dyn, xpnt->next, rel_addr, rel_size, _dl_do_copy);
+ return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
}
-
diff --git a/ldso/ldso/sh64/elfinterp.c b/ldso/ldso/sh64/elfinterp.c
index c85e497b0..fce53dbc3 100644
--- a/ldso/ldso/sh64/elfinterp.c
+++ b/ldso/ldso/sh64/elfinterp.c
@@ -1,7 +1,7 @@
/* vi: set sw=8 ts=8: */
/*
* ldso/ldso/sh64/elfinterp.c
- *
+ *
* SuperH (sh64) ELF shared library loader suppport
*
* Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
@@ -81,13 +81,13 @@ static const char *_dl_reltypes_tab[] = {
static const char *_dl_reltypes(int type)
{
- static char buf[22];
+ static char buf[22];
const char *str;
int tabsize;
tabsize = sizeof(_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0]);
str = _dl_reltypes_tab[type];
-
+
if (type >= tabsize || str == NULL)
str =_dl_simple_ltoa(buf, (unsigned long)(type));
@@ -123,7 +123,7 @@ static void debug_reloc(Elf32_Sym *symtab, char *strtab, ELF_RELOC *rpnt)
symtab_index = ELF32_R_SYM(rpnt->r_info);
sym = symtab_index ? strtab + symtab[symtab_index].st_name
: "sym=0x0";
-
+
_dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
}
@@ -178,13 +178,13 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
symname = strtab + symtab[symtab_index].st_name;
if (reloc_type != R_SH_JMP_SLOT) {
- _dl_dprintf(2, "%s: Incorrect relocation type in jump reloc\n",
+ _dl_dprintf(2, "%s: Incorrect relocation type in jump reloc\n",
_dl_progname);
_dl_exit(1);
}
-
+
/* Address of jump instruction to fix up */
- instr_addr = ((unsigned long)this_reloc->r_offset +
+ instr_addr = ((unsigned long)this_reloc->r_offset +
(unsigned long)tpnt->loadaddr);
got_addr = (char **)instr_addr;
@@ -196,7 +196,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
if (new_addr)
return (unsigned long)new_addr;
-
+
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
_dl_progname, symname);
_dl_exit(1);
@@ -209,7 +209,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
symname);
if (_dl_debug_detail)
- _dl_dprintf(_dl_debug_file,
+ _dl_dprintf(_dl_debug_file,
"\n\tpatched %x ==> %x @ %x\n",
*got_addr, new_addr, got_addr);
}
@@ -247,9 +247,9 @@ static int _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
for (i = 0; i < rel_size; i++, rpnt++) {
int res;
-
+
symtab_index = ELF32_R_SYM(rpnt->r_info);
-
+
/* When the dynamic linker bootstrapped itself, it resolved
some symbols. Make sure we do not do them again */
if (!symtab_index && tpnt->libtype == program_interpreter)
@@ -268,11 +268,11 @@ static int _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
continue;
_dl_dprintf(2, "\n%s: ",_dl_progname);
-
+
if (symtab_index)
_dl_dprintf(2, "symbol '%s': ",
strtab + symtab[symtab_index].st_name);
-
+
if (res < 0) {
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
@@ -281,7 +281,7 @@ static int _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
"%s\n", _dl_reltypes(reloc_type)
#else
"%x\n", reloc_type
-#endif
+#endif
);
_dl_exit(-res);
@@ -306,7 +306,7 @@ static int _dl_do_reloc(struct elf_resolve *tpnt,struct dyn_elf *scope,
#ifdef __SUPPORT_LD_DEBUG__
unsigned long old_val;
#endif
-
+
reloc_type = ELF32_R_TYPE(rpnt->r_info);
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
@@ -318,7 +318,7 @@ static int _dl_do_reloc(struct elf_resolve *tpnt,struct dyn_elf *scope,
if (symtab_index) {
int stb;
- symbol_addr = (unsigned long)_dl_find_hash(symname, scope,
+ symbol_addr = (unsigned long)_dl_find_hash(symname, scope,
(reloc_type == R_SH_JMP_SLOT ? tpnt : NULL),
symbolrel);
@@ -422,7 +422,7 @@ static int _dl_do_reloc(struct elf_resolve *tpnt,struct dyn_elf *scope,
return 0;
}
-
+
static int _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
{
@@ -437,7 +437,7 @@ static int _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
lsb = symtab[symtab_index].st_other & 4;
reloc_addr = (unsigned long *)(intptr_t)
(tpnt->loadaddr + (unsigned long)rpnt->r_offset);
-
+
#ifdef __SUPPORT_LD_DEBUG__
old_val = *reloc_addr;
#endif
@@ -469,7 +469,7 @@ static int _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
/* No, there are cases where the SVr4 linker fails to emit COPY relocs
at all */
-static int _dl_do_copy(struct elf_resolve *tpnt, struct dyn_elf *scope,
+static int _dl_do_copy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
{
int reloc_type;
@@ -478,18 +478,18 @@ static int _dl_do_copy(struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long symbol_addr;
char *symname;
int goof = 0;
-
+
reloc_addr = (unsigned long *)(intptr_t)
(tpnt->loadaddr + (unsigned long)rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- if (reloc_type != R_SH_COPY)
+ if (reloc_type != R_SH_COPY)
return 0;
symtab_index = ELF32_R_SYM(rpnt->r_info);
symbol_addr = 0;
symname = strtab + symtab[symtab_index].st_name;
-
+
if (symtab_index) {
symbol_addr = (unsigned long)
_dl_find_hash(symname, scope, NULL, copyrel);
@@ -507,30 +507,28 @@ static int _dl_do_copy(struct elf_resolve *tpnt, struct dyn_elf *scope,
symbol_addr, symtab[symtab_index].st_value);
#endif
- _dl_memcpy((char *)symtab[symtab_index].st_value,
+ _dl_memcpy((char *)symtab[symtab_index].st_value,
(char *)symbol_addr, symtab[symtab_index].st_size);
}
return goof;
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve *tpnt,
- unsigned long rel_addr, unsigned long rel_size, int type)
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- _dl_parse(tpnt, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
+ (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
}
-int _dl_parse_relocation_information(struct elf_resolve *tpnt,
- unsigned long rel_addr, unsigned long rel_size, int type)
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- return _dl_parse(tpnt, tpnt->symbol_scope, rel_addr,
- rel_size, _dl_do_reloc);
+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
}
-int _dl_parse_copy_information(struct dyn_elf *xpnt, unsigned long rel_addr,
- unsigned long rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
- return _dl_parse(xpnt->dyn, xpnt->next, rel_addr,
- rel_size, _dl_do_copy);
+ return _dl_parse(rpnt->dyn, rpnt->next, rel_addr, rel_size, _dl_do_copy_reloc);
}
diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c
index 64f769485..e9e55c090 100644
--- a/ldso/ldso/sparc/elfinterp.c
+++ b/ldso/ldso/sparc/elfinterp.c
@@ -1,7 +1,7 @@
/* vi: set sw=4 ts=4: */
/* sparc ELF shared library loader suppport
*
- * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
* David Engel, Hongjiu Lu and Mitch D'Souza
*
* All rights reserved.
@@ -57,7 +57,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
int reloc_type;
Elf32_Rela * this_reloc;
char * strtab;
- Elf32_Sym * symtab;
+ Elf32_Sym * symtab;
Elf32_Rela * rel_addr;
struct elf_resolve * tpnt;
int symtab_index;
@@ -66,7 +66,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
unsigned int instr_addr;
tpnt = (struct elf_resolve *) plt[2];
- rel_addr = (Elf32_Rela *) (tpnt->dynamic_info[DT_JMPREL] +
+ rel_addr = (Elf32_Rela *) (tpnt->dynamic_info[DT_JMPREL] +
tpnt->loadaddr);
/*
@@ -108,7 +108,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
#endif
/* Get the address of the GOT entry */
- new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name,
+ new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name,
tpnt->symbol_scope, tpnt, resolver);
if(!new_addr) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
@@ -123,7 +123,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s",
strtab + symtab[symtab_index].st_name);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
}
}
@@ -142,15 +142,17 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt)
return (unsigned int) new_addr;
}
-void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_addr,
- int rel_size, int type){
+void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
+{
int i;
char * strtab;
int reloc_type;
int symtab_index;
- Elf32_Sym * symtab;
+ Elf32_Sym * symtab;
Elf32_Rela * rpnt;
unsigned int * reloc_addr;
+ struct elf_resolve * tpnt = rpnt->dyn;
/* Now parse the relocation information */
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
@@ -187,17 +189,19 @@ void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_ad
};
}
-int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr,
- int rel_size, int type){
+int _dl_parse_relocation_information(struct dyn_elf *rpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
+{
int i;
char * strtab;
int reloc_type;
int goof = 0;
- Elf32_Sym * symtab;
+ Elf32_Sym * symtab;
Elf32_Rela * rpnt;
unsigned int * reloc_addr;
unsigned int symbol_addr;
int symtab_index;
+ struct elf_resolve * tpnt = rpnt->dyn;
/* Now parse the relocation information */
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
@@ -215,11 +219,11 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr,
if(symtab_index) {
- if(tpnt->libtype == program_interpreter &&
+ if(tpnt->libtype == program_interpreter &&
_dl_symbol(strtab + symtab[symtab_index].st_name))
continue;
- symbol_addr = (unsigned int)
+ symbol_addr = (unsigned int)
_dl_find_hash(strtab + symtab[symtab_index].st_name,
tpnt->symbol_scope,
(reloc_type == R_SPARC_JMP_SLOT ? tpnt : NULL), symbolrel);
@@ -274,7 +278,7 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr,
if(symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name);
_dl_dprintf(2, "\n");
_dl_memcpy((void *) symtab[symtab_index].st_value,
- (void *) symbol_addr,
+ (void *) symbol_addr,
symtab[symtab_index].st_size);
#endif
break;
@@ -302,14 +306,14 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr,
/* No, there are cases where the SVr4 linker fails to emit COPY relocs
at all */
-int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr,
- int rel_size, int type)
+int _dl_parse_copy_information(struct dyn_elf *xpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
int i;
char * strtab;
int reloc_type;
int goof = 0;
- Elf32_Sym * symtab;
+ Elf32_Sym * symtab;
Elf32_Rela * rpnt;
unsigned int * reloc_addr;
unsigned int symbol_addr;
@@ -318,7 +322,7 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr,
/* Now parse the relocation information */
tpnt = xpnt->dyn;
-
+
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
@@ -333,11 +337,11 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr,
if(!symtab_index && tpnt->libtype == program_interpreter) continue;
if(symtab_index) {
- if(tpnt->libtype == program_interpreter &&
+ if(tpnt->libtype == program_interpreter &&
_dl_symbol(strtab + symtab[symtab_index].st_name))
continue;
- symbol_addr = (unsigned int)
+ symbol_addr = (unsigned int)
_dl_find_hash(strtab + symtab[symtab_index].st_name,
xpnt->next, NULL, copyrel);
if(!symbol_addr) {
@@ -347,8 +351,8 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr,
};
};
if (!goof)
- _dl_memcpy((char *) symtab[symtab_index].st_value,
- (char *) symbol_addr,
+ _dl_memcpy((char *) symtab[symtab_index].st_value,
+ (char *) symbol_addr,
symtab[symtab_index].st_size);
};
return goof;