diff options
Diffstat (limited to 'libc')
122 files changed, 1965 insertions, 1157 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index d7a659a8c..130a9a505 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -2699,7 +2699,7 @@ int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen, hostp = __open_etc_hosts(); if (hostp == NULL) { *result = NULL; - ret = TRY_AGAIN; + *h_errnop = ret = TRY_AGAIN; goto DONE; } } diff --git a/libc/misc/auxvt/getauxval.c b/libc/misc/auxvt/getauxval.c index 2bdffaf2c..7610b7e5c 100755 --- a/libc/misc/auxvt/getauxval.c +++ b/libc/misc/auxvt/getauxval.c @@ -17,32 +17,28 @@ * <http://www.gnu.org/licenses/>. */ -#include "errno.h" -#include "ldso.h" -#include "sys/auxv.h" +#include <errno.h> +#include <ldso.h> +#include <sys/auxv.h> - -/* - * - * aarch64 gcc 11 uses __getauxval() in init_have_lse_atomics() - * - */ unsigned long int __getauxval (unsigned long int __type) { - if ( __type >= AUX_MAX_AT_ID ){ + // Requested value part of cached subset of auxiliary vector? + if (__type < AUX_MAX_AT_ID) { + if (_dl_auxvt[__type].a_type == __type) + return _dl_auxvt[__type].a_un.a_val; + __set_errno (ENOENT); return 0; } - if ( _dl_auxvt[__type].a_type == __type){ - return _dl_auxvt[__type].a_un.a_val; - } + // Otherwise we have to iterate the auxiliary vector. + for (ElfW(auxv_t) *entry = _dl_auxv_start; entry->a_type != AT_NULL; entry++) + if (entry->a_type == __type) + return entry->a_un.a_val; __set_errno (ENOENT); return 0; } -unsigned long int getauxval (unsigned long int __type){ - return __getauxval( __type ); -} - +weak_alias(__getauxval, getauxval) diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c index 87cd1bb72..09cbefc18 100644 --- a/libc/misc/elf/dl-support.c +++ b/libc/misc/elf/dl-support.c @@ -12,6 +12,7 @@ */ #include <link.h> +#include <ldso.h> #include <elf.h> #if defined(USE_TLS) && USE_TLS #include <assert.h> @@ -31,17 +32,29 @@ ElfW(Phdr) *_dl_phdr; size_t _dl_phnum; size_t _dl_pagesize; +ElfW(auxv_t) _dl_auxvt[AUX_MAX_AT_ID]; +ElfW(auxv_t) *_dl_auxv_start; + void internal_function _dl_aux_init (ElfW(auxv_t) *av); void internal_function _dl_aux_init (ElfW(auxv_t) *av) { + _dl_auxv_start = av; + + memset(_dl_auxvt, 0x00, sizeof(_dl_auxvt)); + for (; av->a_type != AT_NULL; av++) + { + if (av->a_type < AUX_MAX_AT_ID) + _dl_auxvt[av->a_type] = *av; + } + /* Get the program headers base address from the aux vect */ - _dl_phdr = (ElfW(Phdr) *) av[AT_PHDR].a_un.a_val; + _dl_phdr = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val; /* Get the number of program headers from the aux vect */ - _dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val; + _dl_phnum = (size_t) _dl_auxvt[AT_PHNUM].a_un.a_val; /* Get the pagesize from the aux vect */ - _dl_pagesize = (av[AT_PAGESZ].a_un.a_val) ? (size_t) av[AT_PAGESZ].a_un.a_val : PAGE_SIZE; + _dl_pagesize = (_dl_auxvt[AT_PAGESZ].a_un.a_val) ? (size_t) _dl_auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; } #if defined(USE_TLS) && USE_TLS diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 64a9c8214..60695b6ed 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -43,7 +43,7 @@ /* Are we in a secure process environment or are we dealing * with setuid stuff? If we are dynamically linked, then we |