[llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp

Reid Spencer reid at x10sys.com
Wed Jan 10 11:51:00 PST 2007



Changes in directory llvm/lib/System:

DynamicLibrary.cpp updated: 1.18 -> 1.19
---
Log message:

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.


---
Diffs of the changes:  (+12 -2)

 DynamicLibrary.cpp |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)


Index: llvm/lib/System/DynamicLibrary.cpp
diff -u llvm/lib/System/DynamicLibrary.cpp:1.18 llvm/lib/System/DynamicLibrary.cpp:1.19
--- llvm/lib/System/DynamicLibrary.cpp:1.18	Wed Aug 30 15:37:06 2006
+++ llvm/lib/System/DynamicLibrary.cpp	Wed Jan 10 13:50:43 2007
@@ -141,10 +141,11 @@
   // 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 @@
     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;
 }






More information about the llvm-commits mailing list