Changes in directory llvm/lib/ExecutionEngine/JIT:

Intercept.cpp updated: 1.27 -> 1.28
---
Log message:

Fix handling of asm specifiers for external globals. This unbreaks many programs
on leopard in the jit.


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

 Intercept.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/lib/ExecutionEngine/JIT/Intercept.cpp
diff -u llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.27 
llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.28
--- llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.27     Wed Jul 26 19:04:14 2006
+++ llvm/lib/ExecutionEngine/JIT/Intercept.cpp  Fri Jul 28 16:11:31 2006
@@ -100,9 +100,20 @@
   // but print a warning.
   if (Name == "__main") return (void*)(intptr_t)&__mainFunc;
 
+  const char *NameStr = Name.c_str();
+  // If this is an asm specifier, skip the sentinal.
+  if (NameStr[0] == 1) ++NameStr;
+  
   // If it's an external function, look it up in the process image...
-  void *Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(Name);
+  void *Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr);
   if (Ptr) return Ptr;
+  
+  // If it wasn't found and if it starts with an underscore ('_') character, 
and
+  // has an asm specifier, try again without the underscore.
+  if (Name[0] == 1 && NameStr[0] == '_') {
+    Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr+1);
+    if (Ptr) return Ptr;
+  }
 
   std::cerr << "ERROR: Program used external function '" << Name
             << "' which could not be resolved!\n";



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to