static jmp_buf rtld_fail;
static pthread_rwlock_t lock;
static struct debug debug;
+static size_t *auxv;
struct debug *_dl_debug_addr = &debug;
void *__dynlink(int argc, char **argv)
{
- size_t *auxv, aux[AUX_CNT] = {0};
+ size_t aux[AUX_CNT] = {0};
size_t i;
Phdr *phdr;
Ehdr *ehdr;
struct dso *const lib = builtin_dsos+1;
struct dso *const vdso = builtin_dsos+2;
char *env_preload=0;
+ size_t vdso_base;
/* Find aux vector just past environ[] */
for (i=argc+1; argv[i]; i++)
decode_dyn(app);
/* Attach to vdso, if provided by the kernel */
- for (i=0; auxv[i]; i+=2) {
- size_t vdso_base = auxv[i+1];
- if (auxv[i] != AT_SYSINFO_EHDR) continue;
+ if (search_vec(auxv, &vdso_base, AT_SYSINFO_EHDR)) {
ehdr = (void *)vdso_base;
phdr = (void *)(vdso_base + ehdr->e_phoff);
for (i=ehdr->e_phnum; i; i--, phdr=(void *)((char *)phdr + ehdr->e_phentsize)) {
decode_dyn(vdso);
vdso->prev = lib;
lib->next = vdso;
- break;
}
/* Initial dso chain consists only of the app. We temporarily
p->global = 1;
}
+ if (ssp_used) __init_ssp(auxv);
+
_dl_debug_state();
do_init_fini(tail);