From d874064579f4dd8150b0d6ff6d98942af6fcd1c3 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 21 Sep 2015 20:42:44 +0000 Subject: [PATCH] simplify dlstart code by using integer type for base address --- src/ldso/dlstart.c | 15 +++++++-------- 1 file 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