diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-07-28 21:11:31 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-07-28 21:11:31 +0000 |
| commit | e3861501e6fd7bdf8ff21ad22608f41a25cfecde (patch) | |
| tree | 1839a1460f7cad8b36a7364857243965f44dba15 /llvm/lib/ExecutionEngine | |
| parent | ebb592be39bea588d483a9b05c474e7297704cd8 (diff) | |
| download | bcm5719-llvm-e3861501e6fd7bdf8ff21ad22608f41a25cfecde.tar.gz bcm5719-llvm-e3861501e6fd7bdf8ff21ad22608f41a25cfecde.zip | |
Fix handling of asm specifiers for external globals. This unbreaks many programs
on leopard in the jit.
llvm-svn: 29391
Diffstat (limited to 'llvm/lib/ExecutionEngine')
| -rw-r--r-- | llvm/lib/ExecutionEngine/JIT/Intercept.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp index 43298d6349f..db6165f7818 100644 --- a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp +++ b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp @@ -100,9 +100,20 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) { // 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"; |

