diff --git a/lib/libsys/auxv.c b/lib/libsys/auxv.c --- a/lib/libsys/auxv.c +++ b/lib/libsys/auxv.c @@ -76,12 +76,6 @@ static void *fxrng_seed_version; static u_long usrstackbase, usrstacklim; -#ifdef __powerpc__ -static int powerpc_new_auxv_format = 0; -static void _init_aux_powerpc_fixup(void); -int _powerpc_elf_aux_info(int, void *, int); -#endif - /* * This function might be called and actual body executed more than * once in multithreading environment. Due to this, it is and must @@ -172,109 +166,13 @@ case AT_USRSTACKLIM: usrstacklim = aux->a_un.a_val; break; -#ifdef __powerpc__ - /* - * Since AT_STACKPROT is always set, and the common - * value 23 is mutually exclusive with the legacy powerpc - * value 21, the existence of AT_STACKPROT proves we are - * on the common format. - */ - case AT_STACKPROT: /* 23 */ - powerpc_new_auxv_format = 1; - break; -#endif } } -#ifdef __powerpc__ - if (!powerpc_new_auxv_format) - _init_aux_powerpc_fixup(); -#endif atomic_store_rel_int(&aux_once, 1); } -#ifdef __powerpc__ -static void -_init_aux_powerpc_fixup(void) -{ - Elf_Auxinfo *aux; - - /* - * Before 1300070, PowerPC platforms had nonstandard numbering for - * the aux vector. When running old binaries, the kernel will pass - * the vector using the old numbering. Reload affected variables. - */ - for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) { - switch (aux->a_type) { - case AT_OLD_CANARY: - canary = (char *)(aux->a_un.a_ptr); - break; - case AT_OLD_CANARYLEN: - canary_len = aux->a_un.a_val; - break; - case AT_OLD_EXECPATH: - execpath = (char *)(aux->a_un.a_ptr); - break; - case AT_OLD_PAGESIZES: - pagesizes = (char *)(aux->a_un.a_ptr); - break; - case AT_OLD_PAGESIZESLEN: - pagesizes_len = aux->a_un.a_val; - break; - case AT_OLD_OSRELDATE: - osreldate = aux->a_un.a_val; - break; - case AT_OLD_NCPUS: - ncpus = aux->a_un.a_val; - break; - } - } -} - -int -_powerpc_elf_aux_info(int aux, void *buf, int buflen) -{ - - /* - * If we are in the old auxv format, we need to translate the aux - * parameter of elf_aux_info() calls into the common auxv format. - * Internal libc calls always use the common format, and they - * directly call _elf_aux_info instead of using the weak symbol. - */ - if (!powerpc_new_auxv_format) { - switch (aux) { - case AT_OLD_EXECPATH: - aux = AT_EXECPATH; - break; - case AT_OLD_CANARY: - aux = AT_CANARY; - break; - case AT_OLD_CANARYLEN: - aux = AT_CANARYLEN; - break; - case AT_OLD_OSRELDATE: - aux = AT_OSRELDATE; - break; - case AT_OLD_NCPUS: - aux = AT_NCPUS; - break; - case AT_OLD_PAGESIZES: - aux = AT_PAGESIZES; - break; - case AT_OLD_PAGESIZESLEN: - aux = AT_PAGESIZESLEN; - break; - case AT_OLD_STACKPROT: - aux = AT_STACKPROT; - break; - } - } - return _elf_aux_info(aux, buf, buflen); -} -__weak_reference(_powerpc_elf_aux_info, elf_aux_info); -#else __weak_reference(_elf_aux_info, elf_aux_info); -#endif int _elf_aux_info(int aux, void *buf, int buflen) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -521,9 +521,6 @@ char buf[MAXPATHLEN]; int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc; size_t sz; -#ifdef __powerpc__ - int old_auxv_format = 1; -#endif bool dir_enable, dir_ignore, direct_exec, explicit_fd, search_in_path; /* @@ -549,29 +546,8 @@ for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { if (auxp->a_type < AT_COUNT) aux_info[auxp->a_type] = auxp; -#ifdef __powerpc__ - if (auxp->a_type == 23) /* AT_STACKPROT */ - old_auxv_format = 0; -#endif } -#ifdef __powerpc__ - if (old_auxv_format) { - /* Remap from old-style auxv numbers. */ - aux_info[23] = aux_info[21]; /* AT_STACKPROT */ - aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */ - aux_info[19] = aux_info[17]; /* AT_NCPUS */ - aux_info[17] = aux_info[15]; /* AT_CANARYLEN */ - aux_info[15] = aux_info[13]; /* AT_EXECPATH */ - aux_info[13] = NULL; /* AT_GID */ - - aux_info[20] = aux_info[18]; /* AT_PAGESIZES */ - aux_info[18] = aux_info[16]; /* AT_OSRELDATE */ - aux_info[16] = aux_info[14]; /* AT_CANARY */ - aux_info[14] = NULL; /* AT_EGID */ - } -#endif - /* Initialize and relocate ourselves. */ assert(aux_info[AT_BASE] != NULL); init_rtld((caddr_t)aux_info[AT_BASE]->a_un.a_ptr, aux_info);