mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-30 07:14:53 +00:00
Use System/DynamicLibrary instead of Support/DynamicLinker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18357 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
737459df79
commit
df5a37efc9
@ -19,13 +19,13 @@
|
|||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/ModuleProvider.h"
|
#include "llvm/ModuleProvider.h"
|
||||||
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||||
#include "llvm/ExecutionEngine/GenericValue.h"
|
#include "llvm/ExecutionEngine/GenericValue.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include "llvm/Support/DynamicLinker.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -151,7 +151,13 @@ ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
return EE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +508,8 @@ void ExecutionEngine::emitGlobals() {
|
|||||||
} else {
|
} else {
|
||||||
// External variable reference. Try to use the dynamic loader to
|
// External variable reference. Try to use the dynamic loader to
|
||||||
// get a pointer to it.
|
// 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);
|
addGlobalMapping(I, SymAddr);
|
||||||
else {
|
else {
|
||||||
std::cerr << "Could not resolve external global address: "
|
std::cerr << "Could not resolve external global address: "
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "Interpreter.h"
|
#include "Interpreter.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/DynamicLinker.h"
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -71,11 +71,12 @@ static ExFunc lookupFunction(const Function *F) {
|
|||||||
|
|
||||||
ExFunc FnPtr = FuncNames[ExtName];
|
ExFunc FnPtr = FuncNames[ExtName];
|
||||||
if (FnPtr == 0)
|
if (FnPtr == 0)
|
||||||
FnPtr = (ExFunc)GetAddressOfSymbol(ExtName);
|
FnPtr = (ExFunc)sys::DynamicLibrary::SearchForAddressOfSymbol(ExtName);
|
||||||
if (FnPtr == 0)
|
if (FnPtr == 0)
|
||||||
FnPtr = FuncNames["lle_X_"+F->getName()];
|
FnPtr = FuncNames["lle_X_"+F->getName()];
|
||||||
if (FnPtr == 0) // Try calling a generic function... if it exists...
|
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)
|
if (FnPtr != 0)
|
||||||
Functions.insert(std::make_pair(F, FnPtr)); // Cache for later
|
Functions.insert(std::make_pair(F, FnPtr)); // Cache for later
|
||||||
return FnPtr;
|
return FnPtr;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "JIT.h"
|
#include "JIT.h"
|
||||||
#include "llvm/Support/DynamicLinker.h"
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -96,7 +96,7 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) {
|
|||||||
if (Name == "__main") return (void*)&__mainFunc;
|
if (Name == "__main") return (void*)&__mainFunc;
|
||||||
|
|
||||||
// If it's an external function, look it up in the process image...
|
// 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;
|
if (Ptr) return Ptr;
|
||||||
|
|
||||||
std::cerr << "ERROR: Program used external function '" << Name
|
std::cerr << "ERROR: Program used external function '" << Name
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/ExecutionEngine/GenericValue.h"
|
#include "llvm/ExecutionEngine/GenericValue.h"
|
||||||
|
#include "llvm/System/DynamicLibrary.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/TargetJITInfo.h"
|
#include "llvm/Target/TargetJITInfo.h"
|
||||||
#include "llvm/Support/DynamicLinker.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -287,7 +287,7 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
|
|
||||||
// If the global is external, just remember the address.
|
// If the global is external, just remember the address.
|
||||||
if (GV->isExternal()) {
|
if (GV->isExternal()) {
|
||||||
Ptr = GetAddressOfSymbol(GV->getName().c_str());
|
Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(GV->getName().c_str());
|
||||||
if (Ptr == 0) {
|
if (Ptr == 0) {
|
||||||
std::cerr << "Could not resolve external global address: "
|
std::cerr << "Could not resolve external global address: "
|
||||||
<< GV->getName() << "\n";
|
<< GV->getName() << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user