mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-02 08:45:55 +00:00
Put back the initializing the targets in the disassembler API with a comment as
to why this is needed. This broke the darwin's otool(1) program. This change was made in r144385. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8c3b87cf19
commit
fc0d7400bc
@ -18,6 +18,7 @@
|
|||||||
#include "llvm/MC/MCRegisterInfo.h"
|
#include "llvm/MC/MCRegisterInfo.h"
|
||||||
#include "llvm/Support/MemoryObject.h"
|
#include "llvm/Support/MemoryObject.h"
|
||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
|
#include "llvm/Support/TargetSelect.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -35,6 +36,18 @@ using namespace llvm;
|
|||||||
LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,
|
LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,
|
||||||
int TagType, LLVMOpInfoCallback GetOpInfo,
|
int TagType, LLVMOpInfoCallback GetOpInfo,
|
||||||
LLVMSymbolLookupCallback SymbolLookUp) {
|
LLVMSymbolLookupCallback SymbolLookUp) {
|
||||||
|
// Initialize targets and assembly printers/parsers.
|
||||||
|
// FIXME: Clients are responsible for initializing the targets. And this
|
||||||
|
// would be done by calling routines in "llvm-c/Target.h" which are static
|
||||||
|
// line functions. But the current use of LLVMCreateDisasm() is to dynamically
|
||||||
|
// load libLTO with ldopen() and then lookup the symbols using dlsym().
|
||||||
|
// And since these initialize routines are static that does not work which
|
||||||
|
// is why the call to them in this 'C' library API was added back.
|
||||||
|
llvm::InitializeAllTargetInfos();
|
||||||
|
llvm::InitializeAllTargetMCs();
|
||||||
|
llvm::InitializeAllAsmParsers();
|
||||||
|
llvm::InitializeAllDisassemblers();
|
||||||
|
|
||||||
// Get the target.
|
// Get the target.
|
||||||
std::string Error;
|
std::string Error;
|
||||||
const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
|
const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user