Allow LLI, in interpreter mode, to find stdin, stdout, and stderr. This is

a bit of a hack but it lets some of the llvm-test programs run.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-01-10 19:50:43 +00:00
parent 162b02e327
commit 11f457aad3

View File

@ -141,10 +141,11 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
// important symbols are marked 'private external' which doesn't allow // important symbols are marked 'private external' which doesn't allow
// SearchForAddressOfSymbol to find them. As such, we special case them here, // SearchForAddressOfSymbol to find them. As such, we special case them here,
// there is only a small handful of them. // there is only a small handful of them.
#ifdef __APPLE__ #ifdef __APPLE__
{
#define EXPLICIT_SYMBOL(SYM) \ #define EXPLICIT_SYMBOL(SYM) \
extern void *SYM; if (!strcmp(symbolName, #SYM)) return &SYM extern void *SYM; if (!strcmp(symbolName, #SYM)) return &SYM
{
EXPLICIT_SYMBOL(__ashldi3); EXPLICIT_SYMBOL(__ashldi3);
EXPLICIT_SYMBOL(__ashrdi3); EXPLICIT_SYMBOL(__ashrdi3);
EXPLICIT_SYMBOL(__cmpdi2); EXPLICIT_SYMBOL(__cmpdi2);
@ -160,9 +161,18 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
EXPLICIT_SYMBOL(__moddi3); EXPLICIT_SYMBOL(__moddi3);
EXPLICIT_SYMBOL(__udivdi3); EXPLICIT_SYMBOL(__udivdi3);
EXPLICIT_SYMBOL(__umoddi3); EXPLICIT_SYMBOL(__umoddi3);
#undef EXPLICIT_SYMBOL
} }
#undef EXPLICIT_SYMBOL
#endif #endif
#define EXPLICIT_SYMBOL(SYM) \
if (!strcmp(symbolName, #SYM)) return &SYM
// Try a few well known symbols just to give lli a shot at working.
{
EXPLICIT_SYMBOL(stdin);
EXPLICIT_SYMBOL(stdout);
EXPLICIT_SYMBOL(stderr);
}
#undef EXPLICIT_SYMBOL
return 0; return 0;
} }