105 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "SystemInitializerLLGS.h"10 11#if defined(__APPLE__)12#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"13using HostObjectFile = ObjectFileMachO;14#elif defined(_WIN32)15#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"16using HostObjectFile = ObjectFilePECOFF;17#elif defined(_AIX)18#include "Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h"19using HostObjectFile = ObjectFileXCOFF;20#else21#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"22using HostObjectFile = ObjectFileELF;23#endif24 25#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)26#define LLDB_TARGET_ARM6427#endif28 29#if defined(__arm__) || defined(__arm) || defined(_ARM) || defined(_M_ARM) || \30 defined(LLDB_TARGET_ARM64)31#define LLDB_TARGET_ARM32#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"33#endif34 35#if defined(__loongarch__)36#define LLDB_TARGET_LoongArch37#include "Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h"38#endif39 40#if defined(__mips64__) || defined(mips64) || defined(__mips64) || \41 defined(__MIPS64__) || defined(_M_MIPS64)42#define LLDB_TARGET_MIPS6443#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"44#endif45 46#if defined(__mips__) || defined(mips) || defined(__mips) || \47 defined(__MIPS__) || defined(_M_MIPS) || defined(LLDB_TARGET_MIPS64)48#define LLDB_TARGET_MIPS49#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"50#endif51 52#if defined(__riscv)53#define LLDB_TARGET_RISCV54#include "Plugins/Instruction/RISCV/EmulateInstructionRISCV.h"55#endif56 57using namespace lldb_private;58 59llvm::Error SystemInitializerLLGS::Initialize() {60 if (auto e = SystemInitializerCommon::Initialize())61 return e;62 63 HostObjectFile::Initialize();64 65#if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)66 EmulateInstructionARM::Initialize();67#endif68#if defined(LLDB_TARGET_LoongArch)69 EmulateInstructionLoongArch::Initialize();70#endif71#if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)72 EmulateInstructionMIPS::Initialize();73#endif74#if defined(LLDB_TARGET_MIPS64)75 EmulateInstructionMIPS64::Initialize();76#endif77#if defined(LLDB_TARGET_RISCV)78 EmulateInstructionRISCV::Initialize();79#endif80 81 return llvm::Error::success();82}83 84void SystemInitializerLLGS::Terminate() {85 HostObjectFile::Terminate();86 87#if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)88 EmulateInstructionARM::Terminate();89#endif90#if defined(LLDB_TARGET_LoongArch)91 EmulateInstructionLoongArch::Terminate();92#endif93#if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)94 EmulateInstructionMIPS::Terminate();95#endif96#if defined(LLDB_TARGET_MIPS64)97 EmulateInstructionMIPS64::Terminate();98#endif99#if defined(LLDB_TARGET_RISCV)100 EmulateInstructionRISCV::Terminate();101#endif102 103 SystemInitializerCommon::Terminate();104}105