From 5904458c245a64e61eea8bf2dcd7bfbdefab5500 Mon Sep 17 00:00:00 2001 From: John Ellson <ellson@research.att.com> Date: Fri, 1 Nov 2013 16:22:15 -0400 Subject: [PATCH] apply patch-lib__vmalloc__features__vmalloc-dyld-uses-malloc.diff (from ryandesign) --- lib/vmalloc/features/vmalloc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/vmalloc/features/vmalloc b/lib/vmalloc/features/vmalloc index 5d632c6e0..1512a1e27 100644 --- a/lib/vmalloc/features/vmalloc +++ b/lib/vmalloc/features/vmalloc @@ -44,16 +44,23 @@ mal alloca note{ alloca is based on malloc() }end execute{ #if _hdr_alloca #include <alloca.h> #endif + #include <dlfcn.h> + volatile int testing_alloca = 0; #if _STD_ void* malloc(unsigned int size) #else void* malloc(size) unsigned int size; #endif - { exit(0); + { if (!testing_alloca) { + return ((void *(*)(unsigned int)) dlsym(RTLD_NEXT, "malloc"))(size); + } + exit(0); return 0; } main() - { alloca(10); + { testing_alloca = 1; + alloca(10); + testing_alloca = 0; return 1; } }end -- 2.40.0