1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Provide hook for alloca on VCPP. Patch by Scott Graham

llvm-svn: 37715
This commit is contained in:
Anton Korobeynikov 2007-06-25 07:12:14 +00:00
parent 293173ccd2
commit c8aa8f8ba7

View File

@ -88,7 +88,9 @@ 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) \
@ -96,7 +98,11 @@ DynamicLibrary::~DynamicLibrary() {
#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,12 +139,20 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
return (void *) ptr;
}
#ifdef __MINGW32__
#if defined(__MINGW32__)
{
EXPLICIT_SYMBOL(_alloca);
EXPLICIT_SYMBOL2(alloca, _alloca);
#undef EXPLICIT_SYMBOL
#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