From 6952d90ad3edfc461ecbe081f121419f4072326c Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Tue, 16 Feb 2016 22:55:13 +0100 Subject: Fix NetBSD build issue: Use compiler version of alloca(3) when possible The documentation of alloca(3) says: o The alloca() function should be supplied by the compiler because the compiler is allowed to make assumptions about the stack and frame pointers. The libc alloca() implementation cannot account for those assumptions. While there is a machine dependent implementation of alloca() in libc, its use is discouraged and in most cases it will not work. Using this implementation will produce linker warnings. This is true for CoreCLR - alloca(3) was breaking 30 PAL tests. Enforce on this operating system a compiler version. Thanks Jan Kotas (Microsoft) for inspiration what may go wrong. Thanks Jan Vorli (Microsoft) for useful suggestions in order to fix it. --- src/ToolBox/SOS/Strike/strike.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/ToolBox/SOS') diff --git a/src/ToolBox/SOS/Strike/strike.h b/src/ToolBox/SOS/Strike/strike.h index a23a3f17bb..d6bd54dc54 100644 --- a/src/ToolBox/SOS/Strike/strike.h +++ b/src/ToolBox/SOS/Strike/strike.h @@ -76,6 +76,16 @@ #ifndef PAL_STDCPP_COMPAT #include #endif + +#ifdef FEATURE_PAL +#ifndef alloca +#define alloca __builtin_alloca +#endif +#ifndef _alloca +#define _alloca __builtin_alloca +#endif +#endif // FEATURE_PAL + #include #ifndef FEATURE_PAL @@ -128,4 +138,3 @@ HRESULT SetNGENCompilerFlags(DWORD flags); #endif // __strike_h__ - -- cgit v1.2.3