#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/GenericValue.h"
-#include "llvm/Target/TargetData.h"
#include "llvm/Support/Debug.h"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/Support/DynamicLinker.h"
+#include "llvm/System/DynamicLibrary.h"
+#include "llvm/Target/TargetData.h"
using namespace llvm;
namespace {
}
}
- if (EE == 0) delete IL;
+ if (EE == 0)
+ delete IL;
+ else
+ // Make sure we can resolve symbols in the program as well. The zero arg
+ // to the function tells DynamicLibrary to load the program, not a library.
+ sys::DynamicLibrary::LoadLibraryPermanently(0);
+
return EE;
}
} else {
// External variable reference. Try to use the dynamic loader to
// get a pointer to it.
- if (void *SymAddr = GetAddressOfSymbol(I->getName().c_str()))
+ if (void *SymAddr = sys::DynamicLibrary::SearchForAddressOfSymbol(
+ I->getName().c_str()))
addGlobalMapping(I, SymAddr);
else {
std::cerr << "Could not resolve external global address: "
#include "Interpreter.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
+#include "llvm/System/DynamicLibrary.h"
#include "llvm/Target/TargetData.h"
-#include "llvm/Support/DynamicLinker.h"
#include <cmath>
#include <csignal>
#include <map>
ExFunc FnPtr = FuncNames[ExtName];
if (FnPtr == 0)
- FnPtr = (ExFunc)GetAddressOfSymbol(ExtName);
+ FnPtr = (ExFunc)sys::DynamicLibrary::SearchForAddressOfSymbol(ExtName);
if (FnPtr == 0)
FnPtr = FuncNames["lle_X_"+F->getName()];
if (FnPtr == 0) // Try calling a generic function... if it exists...
- FnPtr = (ExFunc)GetAddressOfSymbol(("lle_X_"+F->getName()).c_str());
+ FnPtr = (ExFunc)sys::DynamicLibrary::SearchForAddressOfSymbol(
+ ("lle_X_"+F->getName()).c_str());
if (FnPtr != 0)
Functions.insert(std::make_pair(F, FnPtr)); // Cache for later
return FnPtr;
//===----------------------------------------------------------------------===//
#include "JIT.h"
-#include "llvm/Support/DynamicLinker.h"
+#include "llvm/System/DynamicLibrary.h"
#include <iostream>
#include <sys/stat.h>
using namespace llvm;
if (Name == "__main") return (void*)&__mainFunc;
// If it's an external function, look it up in the process image...
- void *Ptr = GetAddressOfSymbol(Name);
+ void *Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(Name);
if (Ptr) return Ptr;
std::cerr << "ERROR: Program used external function '" << Name
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/ExecutionEngine/GenericValue.h"
+#include "llvm/System/DynamicLibrary.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetJITInfo.h"
-#include "llvm/Support/DynamicLinker.h"
#include <iostream>
using namespace llvm;
// If the global is external, just remember the address.
if (GV->isExternal()) {
- Ptr = GetAddressOfSymbol(GV->getName().c_str());
+ Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(GV->getName().c_str());
if (Ptr == 0) {
std::cerr << "Could not resolve external global address: "
<< GV->getName() << "\n";