[llvm] 6747fc0 - [ORC] Use JITLink as the default linker for LLJIT on Linux/arm64.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 4 21:09:31 PST 2023
Author: Lang Hames
Date: 2023-02-05T05:09:26Z
New Revision: 6747fc07d1aa94e22622e278e5a02ba70675ac9b
URL: https://github.com/llvm/llvm-project/commit/6747fc07d1aa94e22622e278e5a02ba70675ac9b
DIFF: https://github.com/llvm/llvm-project/commit/6747fc07d1aa94e22622e278e5a02ba70675ac9b.diff
LOG: [ORC] Use JITLink as the default linker for LLJIT on Linux/arm64.
Also updates the OrcCAPIsTest unit test to enable the C API tests on Linux.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index bc84988e32542..a9cc6680c9eb4 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -715,11 +715,22 @@ Error LLJITBuilderState::prepareForConstruction() {
// JIT linker.
if (!CreateObjectLinkingLayer) {
auto &TT = JTMB->getTargetTriple();
- if (TT.getArch() == Triple::riscv64 ||
- TT.getArch() == Triple::loongarch64 ||
- (TT.isOSBinFormatMachO() &&
- (TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64))) {
-
+ bool UseJITLink = false;
+ switch (TT.getArch()) {
+ case Triple::riscv64:
+ case Triple::loongarch64:
+ UseJITLink = true;
+ break;
+ case Triple::aarch64:
+ UseJITLink = !TT.isOSBinFormatCOFF();
+ break;
+ case Triple::x86_64:
+ UseJITLink = TT.isOSBinFormatMachO();
+ break;
+ default:
+ break;
+ }
+ if (UseJITLink) {
JTMB->setRelocationModel(Reloc::PIC_);
JTMB->setCodeModel(CodeModel::Small);
CreateObjectLinkingLayer =
diff --git a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
index 41c297bffe635..7df4213ef4ad5 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
@@ -46,3 +46,5 @@ target_link_libraries(OrcJITTests PRIVATE
${ORC_JIT_TEST_LIBS})
set_property(TARGET OrcJITTests PROPERTY FOLDER "Tests/UnitTests/ExecutionTests")
+
+export_executable_symbols(OrcJITTests)
More information about the llvm-commits
mailing list