summaryrefslogtreecommitdiff
path: root/ldso/ldso/sh64
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-01-29 12:18:58 +0000
committerEric Andersen <andersen@codepoet.org>2004-01-29 12:18:58 +0000
commit875a6e83f49ae0833d9ef45ee23da87f66c5aa3c (patch)
treeecef1fd217717e71fe0fa033dfcec4ffbbbcc07b /ldso/ldso/sh64
parent8391a5231556a37c6f7eef871c3e310e91623b00 (diff)
Modify interfaces for _dl_parse_relocation_information()
_dl_parse_lazy_relocation_information() and _dl_parse_copy_information() so they are all consistant, allowing for future consolidation. Trim some trailing whitespace as well.
Diffstat (limited to 'ldso/ldso/sh64')
-rw-r--r--ldso/ldso/sh64/elfinterp.c66
1 files changed, 32 insertions, 34 deletions
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);
}