summaryrefslogtreecommitdiff
path: root/src/ToolBox/SOS
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2016-02-16 22:55:13 +0100
committerKamil Rytarowski <n54@gmx.com>2016-02-17 21:30:25 +0100
commit6952d90ad3edfc461ecbe081f121419f4072326c (patch)
tree3cb6501aa8bd1a278994bfa5dc9b0494e481f1fd /src/ToolBox/SOS
parent5a26372691fea92f1ef328f287e1e37243af3e34 (diff)
downloadcoreclr-6952d90ad3edfc461ecbe081f121419f4072326c.tar.gz
coreclr-6952d90ad3edfc461ecbe081f121419f4072326c.tar.bz2
coreclr-6952d90ad3edfc461ecbe081f121419f4072326c.zip
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.
Diffstat (limited to 'src/ToolBox/SOS')
-rw-r--r--src/ToolBox/SOS/Strike/strike.h11
1 files changed, 10 insertions, 1 deletions
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 <malloc.h>
#endif
+
+#ifdef FEATURE_PAL
+#ifndef alloca
+#define alloca __builtin_alloca
+#endif
+#ifndef _alloca
+#define _alloca __builtin_alloca
+#endif
+#endif // FEATURE_PAL
+
#include <stddef.h>
#ifndef FEATURE_PAL
@@ -128,4 +138,3 @@ HRESULT SetNGENCompilerFlags(DWORD flags);
#endif // __strike_h__
-