From: GNU Libc Maintainers Date: Sat, 17 Sep 2016 18:00:44 +0000 (+0000) Subject: unsubmitted-libc_alloca_cutoff X-Git-Tag: archive/raspbian/2.25-3+rpi1~1^2^2^2^2^2^2^2^2^2^2^2^2~81 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=74a441fdf477782307bd88aee89265200d96b4b8;p=glibc.git unsubmitted-libc_alloca_cutoff =================================================================== Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name unsubmitted-libc_alloca_cutoff.diff --- diff --git a/libpthread/Makefile b/libpthread/Makefile index 29067885e..b42bf3922 100644 --- a/libpthread/Makefile +++ b/libpthread/Makefile @@ -191,7 +191,7 @@ headers := \ ifeq ($(IN_GLIBC),yes) distribute := -routines := forward libc_pthread_init +routines := forward libc_pthread_init alloca_cutoff shared-only-routines = forward vpath %.c diff --git a/libpthread/Versions b/libpthread/Versions index 0c08cea97..75ef59df6 100644 --- a/libpthread/Versions +++ b/libpthread/Versions @@ -39,6 +39,7 @@ libc { __pthread_get_cleanup_stack; } GLIBC_PRIVATE { + __libc_alloca_cutoff; __libc_pthread_init; } } diff --git a/libpthread/pthread/alloca_cutoff.c b/libpthread/pthread/alloca_cutoff.c new file mode 100644 index 000000000..8e7f95b77 --- /dev/null +++ b/libpthread/pthread/alloca_cutoff.c @@ -0,0 +1,7 @@ +#include +int +__libc_alloca_cutoff (size_t size) +{ + return size <= 4096; +} +libc_hidden_def (__libc_alloca_cutoff) diff --git a/sysdeps/pthread/allocalim.h b/sysdeps/pthread/allocalim.h index 076889463..3d43d2a00 100644 --- a/sysdeps/pthread/allocalim.h +++ b/sysdeps/pthread/allocalim.h @@ -24,6 +24,9 @@ extern __always_inline int __libc_use_alloca (size_t size) { - return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1) - || __builtin_expect (__libc_alloca_cutoff (size), 1)); + return ( +#ifdef PTHREAD_STACK_MIN + __builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1) || +#endif + __builtin_expect (__libc_alloca_cutoff (size), 1)); }