| From d8f3041c669e04d001299d45ac9273988dd4bab8 Mon Sep 17 00:00:00 2001 |
| From: Dan Padgett <dpadgett@google.com> |
| Date: Thu, 24 Mar 2016 13:53:15 -0700 |
| Subject: [PATCH 05/17] brcm auxv patch. |
| |
| --- |
| package/uclibc/uclibc-0064-brcm-auxvec.patch | 81 ++++++++++++++++++++++++++++ |
| 1 file changed, 81 insertions(+) |
| create mode 100644 package/uclibc/uclibc-0064-brcm-auxvec.patch |
| |
| diff --git a/package/uclibc/uclibc-0064-brcm-auxvec.patch b/package/uclibc/uclibc-0064-brcm-auxvec.patch |
| new file mode 100644 |
| index 0000000..4dc0310 |
| --- /dev/null |
| +++ b/package/uclibc/uclibc-0064-brcm-auxvec.patch |
| @@ -0,0 +1,81 @@ |
| +commit c8a44ca1203244e18be053bd90b6b6df88d93d67 |
| +Author: Kevin Cernekee <cernekee@gmail.com> |
| +Date: Wed Apr 13 19:34:46 2011 -0700 |
| + |
| + Cache AT_PLATFORM and AT_L1D_CACHESHAPE from auxvec |
| + |
| + Allow uClibc internal functions to make optimizations at runtime, based |
| + on the CPU type or D$ line size retrieved from the auxiliary vector. |
| + This would nominally be used for functions like memcpy(), on processors |
| + that do not have an unprivileged instruction along the lines of "CPUID". |
| + |
| + Signed-off-by: Kevin Cernekee <cernekee@gmail.com> |
| + |
| +diff --git a/include/libc-internal.h b/include/libc-internal.h |
| +index 3ac0b05..ef5ce59 100644 |
| +--- a/include/libc-internal.h |
| ++++ b/include/libc-internal.h |
| +@@ -65,6 +65,10 @@ libc_hidden_proto(__glibc_strerror_r) |
| + /* internal access to program name */ |
| + extern const char *__uclibc_progname attribute_hidden; |
| + |
| ++/* internal access to auxvec AT_PLATFORM, cache info */ |
| ++extern const char *__auxv_platform attribute_hidden; |
| ++extern int __auxv_l1d_cacheshape attribute_hidden; |
| ++ |
| + # ifdef __UCLIBC_HAS_FORTIFY__ |
| + extern void __chk_fail(void) attribute_noreturn; |
| + libc_hidden_proto(__chk_fail) |
| +diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c |
| +index 632a252..4bb36cc 100644 |
| +--- a/libc/misc/internals/__uClibc_main.c |
| ++++ b/libc/misc/internals/__uClibc_main.c |
| +@@ -28,6 +28,7 @@ |
| + #ifndef __ARCH_HAS_NO_LDSO__ |
| + #include <fcntl.h> |
| + #endif |
| ++#include <libc-internal.h> |
| + #ifdef __UCLIBC_HAS_THREADS_NATIVE__ |
| + #include <pthread-functions.h> |
| + #include <not-cancel.h> |
| +@@ -173,6 +174,12 @@ weak_alias (__progname_full, program_invocation_name) |
| + # endif |
| + #endif |
| + |
| ++/* Highest numbered auxvec entry to copy into auxvt[] */ |
| ++#define AT_MAX AT_L3_CACHESHAPE |
| ++ |
| ++attribute_hidden const char *__auxv_platform = NULL; |
| ++attribute_hidden int __auxv_l1d_cacheshape = 0; |
| ++ |
| + /* |
| + * Declare the __environ global variable and create a weak alias environ. |
| + * This must be initialized; we cannot have a weak alias into bss. |
| +@@ -342,7 +349,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, |
| + { |
| + #if !defined __ARCH_HAS_NO_LDSO__ && !defined SHARED |
| + unsigned long *aux_dat; |
| +- ElfW(auxv_t) auxvt[AT_EGID + 1]; |
| ++ ElfW(auxv_t) auxvt[AT_MAX + 1]; |
| + #endif |
| + |
| + #ifdef __UCLIBC_HAS_THREADS_NATIVE__ |
| +@@ -376,7 +383,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, |
| + aux_dat++; |
| + while (*aux_dat) { |
| + ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat; |
| +- if (auxv_entry->a_type <= AT_EGID) { |
| ++ if (auxv_entry->a_type <= AT_MAX) { |
| + memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); |
| + } |
| + aux_dat += 2; |
| +@@ -398,6 +405,9 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, |
| + __pagesize = _dl_pagesize; |
| + |
| + #ifndef SHARED |
| ++ __auxv_platform = (char *)auxvt[AT_PLATFORM].a_un.a_val; |
| ++ __auxv_l1d_cacheshape = (int)auxvt[AT_L1D_CACHESHAPE].a_un.a_val; |
| ++ |
| + /* Prevent starting SUID binaries where the stdin. stdout, and |
| + * stderr file descriptors are not already opened. */ |
| + if ((auxvt[AT_UID].a_un.a_val == (size_t)-1 && __check_suid()) || |
| -- |
| 2.8.0.rc3.226.g39d4020 |
| |