aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2007-06-25 07:12:14 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2007-06-25 07:12:14 +0000
commit5248896635195dfa1df742c05c5faa157a501988 (patch)
tree4a37f84802e587d0c7615f42ccb2eb1530d8334a /lib/System
parentf62c44a38dae790a4ba9491e1199a8e443fed63b (diff)
downloadexternal_llvm-5248896635195dfa1df742c05c5faa157a501988.zip
external_llvm-5248896635195dfa1df742c05c5faa157a501988.tar.gz
external_llvm-5248896635195dfa1df742c05c5faa157a501988.tar.bz2
Provide hook for alloca on VCPP. Patch by Scott Graham
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Win32/DynamicLibrary.inc22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/System/Win32/DynamicLibrary.inc b/lib/System/Win32/DynamicLibrary.inc
index 91de113..251131e 100644
--- a/lib/System/Win32/DynamicLibrary.inc
+++ b/lib/System/Win32/DynamicLibrary.inc
@@ -88,15 +88,21 @@ DynamicLibrary::~DynamicLibrary() {
}
}
-#ifdef __MINGW32__
+// Stack probing routines are in the support library (e.g. libgcc), but we don't
+// have dynamic linking on windows. Provide a hook.
+#if defined(__MINGW32__) || defined (_MSC_VER)
#define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return (void*)&SYM
#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \
if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO
#define EXPLICIT_SYMBOL_DEF(SYM) \
extern "C" { extern void *SYM; }
-
- EXPLICIT_SYMBOL_DEF(_alloca);
+
+ #if defined(__MINGW32__)
+ EXPLICIT_SYMBOL_DEF(_alloca);
+ #elif defined(_MSC_VER)
+ EXPLICIT_SYMBOL_DEF(_alloca_probe);
+ #endif
#endif
bool DynamicLibrary::LoadLibraryPermanently(const char *filename,
@@ -133,7 +139,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
return (void *) ptr;
}
-#ifdef __MINGW32__
+#if defined(__MINGW32__)
{
EXPLICIT_SYMBOL(_alloca);
EXPLICIT_SYMBOL2(alloca, _alloca);
@@ -141,6 +147,14 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
#undef EXPLICIT_SYMBOL2
#undef EXPLICIT_SYMBOL_DEF
}
+#elif defined(_MSC_VER)
+ {
+ EXPLICIT_SYMBOL2(alloca, _alloca_probe);
+ EXPLICIT_SYMBOL2(_alloca, _alloca_probe);
+#undef EXPLICIT_SYMBOL
+#undef EXPLICIT_SYMBOL2
+#undef EXPLICIT_SYMBOL_DEF
+ }
#endif
return 0;