From 9bcb9226f6b03d143b47cdeb894002f394975a21 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 24 Nov 2012 16:59:10 +0000 Subject: libLTO: Add a utility method to initialize the disassemblers. Necessary to give disassembler users (like darwin's otool) a possibility to dlopen libLTO and still initialize the required LLVM bits. This used to go through libMCDisassembler but that's a gross layering violation, the MC layer can't pull in functions from the targets. Adding a function to libLTO is a bit of a hack but not worse than exposing other disassembler bits from libLTO. Fixes PR14362. llvm-svn: 168545 --- llvm/lib/MC/MCDisassembler/Disassembler.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'llvm/lib/MC/MCDisassembler/Disassembler.cpp') diff --git a/llvm/lib/MC/MCDisassembler/Disassembler.cpp b/llvm/lib/MC/MCDisassembler/Disassembler.cpp index 5189c9d..490ca75 100644 --- a/llvm/lib/MC/MCDisassembler/Disassembler.cpp +++ b/llvm/lib/MC/MCDisassembler/Disassembler.cpp @@ -20,7 +20,6 @@ #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/MemoryObject.h" #include "llvm/Support/TargetRegistry.h" -#include "llvm/Support/TargetSelect.h" #include "llvm/Support/ErrorHandling.h" namespace llvm { @@ -38,18 +37,6 @@ using namespace llvm; LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, 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 dlopen() 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. std::string Error; const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error); -- cgit v1.1