1 //===-- SystemInitializerLLGS.cpp -------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "SystemInitializerLLGS.h" 10 11 #if defined(__APPLE__) 12 #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" 13 using HostObjectFile = ObjectFileMachO; 14 #elif defined(_WIN32) 15 #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" 16 using HostObjectFile = ObjectFilePECOFF; 17 #else 18 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h" 19 using HostObjectFile = ObjectFileELF; 20 #endif 21 22 #if defined(__arm__) || defined(__arm) || defined(_ARM) || defined(_M_ARM) 23 #define LLDB_TARGET_ARM 24 #include "Plugins/Instruction/ARM/EmulateInstructionARM.h" 25 #endif 26 27 #if defined(__mips__) || defined(mips) || defined(__mips) || \ 28 defined(__MIPS__) || defined(_M_MIPS) 29 #define LLDB_TARGET_MIPS 30 #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h" 31 #endif 32 33 #if defined(__mips64__) || defined(mips64) || defined(__mips64) || \ 34 defined(__MIPS64__) || defined(_M_MIPS64) 35 #define LLDB_TARGET_MIPS64 36 #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" 37 #endif 38 39 using namespace lldb_private; 40 41 llvm::Error SystemInitializerLLGS::Initialize() { 42 if (auto e = SystemInitializerCommon::Initialize()) 43 return e; 44 45 HostObjectFile::Initialize(); 46 47 #if defined(LLDB_TARGET_ARM) 48 EmulateInstructionARM::Initialize(); 49 #endif 50 #if defined(LLDB_TARGET_MIPS) 51 EmulateInstructionMIPS::Initialize(); 52 #endif 53 #if defined(LLDB_TARGET_MIPS64) 54 EmulateInstructionMIPS64::Initialize(); 55 #endif 56 57 return llvm::Error::success(); 58 } 59 60 void SystemInitializerLLGS::Terminate() { 61 HostObjectFile::Terminate(); 62 63 #if defined(LLDB_TARGET_ARM) 64 EmulateInstructionARM::Terminate(); 65 #endif 66 #if defined(LLDB_TARGET_MIPS) 67 EmulateInstructionMIPS::Terminate(); 68 #endif 69 #if defined(LLDB_TARGET_MIPS64) 70 EmulateInstructionMIPS64::Terminate(); 71 #endif 72 73 SystemInitializerCommon::Terminate(); 74 } 75