summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ldso/dlstart.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ldso/dlstart.c b/src/ldso/dlstart.c
index a968baab..e84e073e 100644
--- a/src/ldso/dlstart.c
+++ b/src/ldso/dlstart.c
@@ -21,6 +21,7 @@ __attribute__((__visibility__("hidden")))
void _dlstart_c(size_t *sp, size_t *dynv)
{
size_t i, aux[AUX_CNT], dyn[DYN_CNT];
+ size_t *rel, rel_size, base;
int argc = *sp;
char **argv = (void *)(sp+1);
@@ -40,14 +41,14 @@ void _dlstart_c(size_t *sp, size_t *dynv)
* address is not available in the aux vector. Instead, compute
* the load address as the difference between &_DYNAMIC and the
* virtual address in the PT_DYNAMIC program header. */
- unsigned char *base = (void *)aux[AT_BASE];
+ base = aux[AT_BASE];
if (!base) {
size_t phnum = aux[AT_PHNUM];
size_t phentsize = aux[AT_PHENT];
Phdr *ph = (void *)aux[AT_PHDR];
for (i=phnum; i--; ph = (void *)((char *)ph + phentsize)) {
if (ph->p_type == PT_DYNAMIC) {
- base = (void *)((size_t)dynv - ph->p_vaddr);
+ base = (size_t)dynv - ph->p_vaddr;
break;
}
}
@@ -61,17 +62,15 @@ void _dlstart_c(size_t *sp, size_t *dynv)
size_t *got = (void *)(base + dyn[DT_PLTGOT]);
for (i=0; dynv[i]; i+=2) if (dynv[i]==DT_MIPS_LOCAL_GOTNO)
local_cnt = dynv[i+1];
- for (i=0; i<local_cnt; i++) got[i] += (size_t)base;
+ for (i=0; i<local_cnt; i++) got[i] += base;
}
- size_t *rel, rel_size;
-
rel = (void *)(base+dyn[DT_REL]);
rel_size = dyn[DT_RELSZ];
for (; rel_size; rel+=2, rel_size-=2*sizeof(size_t)) {
if (!IS_RELATIVE(rel[1])) continue;
size_t *rel_addr = (void *)(base + rel[0]);
- *rel_addr += (size_t)base;
+ *rel_addr += base;
}
rel = (void *)(base+dyn[DT_RELA]);
@@ -79,12 +78,12 @@ void _dlstart_c(size_t *sp, size_t *dynv)
for (; rel_size; rel+=3, rel_size-=3*sizeof(size_t)) {
if (!IS_RELATIVE(rel[1])) continue;
size_t *rel_addr = (void *)(base + rel[0]);
- *rel_addr = (size_t)base + rel[2];
+ *rel_addr = base + rel[2];
}
stage2_func dls2;
GETFUNCSYM(&dls2, __dls2, base+dyn[DT_PLTGOT]);
- dls2(base, sp);
+ dls2((void *)base, sp);
}
#endif