aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/System/DynamicLibrary.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-10 19:50:43 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-10 19:50:43 +0000
commit1b2eeedd85d9b565bf55b85a4db16efaea68c159 (patch)
treef9e48c95f3629014d99013faf598d0dd97c7bc13 /llvm/lib/System/DynamicLibrary.cpp
parentc6c4fab0677a6cefbee431dd03f26341625c2970 (diff)
downloadllvm-1b2eeedd85d9b565bf55b85a4db16efaea68c159.zip
llvm-1b2eeedd85d9b565bf55b85a4db16efaea68c159.tar.gz
llvm-1b2eeedd85d9b565bf55b85a4db16efaea68c159.tar.bz2
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. llvm-svn: 33058
Diffstat (limited to 'llvm/lib/System/DynamicLibrary.cpp')
-rw-r--r--llvm/lib/System/DynamicLibrary.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/System/DynamicLibrary.cpp b/llvm/lib/System/DynamicLibrary.cpp
index 0876d5d..f0ab51b 100644
--- a/llvm/lib/System/DynamicLibrary.cpp
+++ b/llvm/lib/System/DynamicLibrary.cpp
@@ -141,10 +141,11 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
// important symbols are marked 'private external' which doesn't allow
// SearchForAddressOfSymbol to find them. As such, we special case them here,
// there is only a small handful of them.
+
#ifdef __APPLE__
- {
#define EXPLICIT_SYMBOL(SYM) \
extern void *SYM; if (!strcmp(symbolName, #SYM)) return &SYM
+ {
EXPLICIT_SYMBOL(__ashldi3);
EXPLICIT_SYMBOL(__ashrdi3);
EXPLICIT_SYMBOL(__cmpdi2);
@@ -160,9 +161,18 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
EXPLICIT_SYMBOL(__moddi3);
EXPLICIT_SYMBOL(__udivdi3);
EXPLICIT_SYMBOL(__umoddi3);
-#undef EXPLICIT_SYMBOL
}
+#undef EXPLICIT_SYMBOL
#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;
}