Files
clang-p2996/llvm/lib/Target/LoongArch/TargetInfo/LoongArchTargetInfo.cpp
wanglei f10d452db8 Reland "[JITLink] Add an initial implementation of JITLink for ELF/LoongArch"
This implementation supports basic relocation types and adds EHFrame,
Got/Plt handling passes.
This patch also enables JIT support for LoongArch64.

With this patch, I successfully run hello.ll and simple_throw.ll
(which is generated from test-suite/SingleSource/Regression/C++/EH/simple_throw.cpp)
using the `lli` command with options `--jit-kind=orc --jit-linker=jitlink`.

Note: `hasJIT` property of LoongArch32 remains false as there is no
validation environment.

New changes: Since LoongArch does not support RuntimeDyld, JITLink is set
by default.  Add a null-terminator to eh-frame sections. This should fix
the test failure on LoongArch bot.
(https://lab.llvm.org/staging/#/builders/236/builds/896)

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D141036
2023-01-18 20:49:20 +08:00

31 lines
1.0 KiB
C++

//===-- LoongArchTargetInfo.cpp - LoongArch Target Implementation ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "TargetInfo/LoongArchTargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
using namespace llvm;
Target &llvm::getTheLoongArch32Target() {
static Target TheLoongArch32Target;
return TheLoongArch32Target;
}
Target &llvm::getTheLoongArch64Target() {
static Target TheLoongArch64Target;
return TheLoongArch64Target;
}
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLoongArchTargetInfo() {
RegisterTarget<Triple::loongarch32, /*HasJIT=*/false> X(
getTheLoongArch32Target(), "loongarch32", "32-bit LoongArch",
"LoongArch");
RegisterTarget<Triple::loongarch64, /*HasJIT=*/true> Y(
getTheLoongArch64Target(), "loongarch64", "64-bit LoongArch",
"LoongArch");
}