From dfdb4a682523a95b5a2195bd4a4a10a9ee37612f Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 22 Mar 2025 16:33:13 +0000 Subject: [PATCH 1/2] Switch RISC-V to large code model on LLVM 20 Given https://github.com/llvm/llvm-project/pull/70308 is in LLVM 20, I guess we can switch to it barring any bugs. --- src/jitlayers.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index c5588be794201..8c8ecbe2d2580 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -1386,9 +1386,11 @@ namespace { if (TheTriple.isAArch64()) codemodel = CodeModel::Small; else if (TheTriple.isRISCV()) { - // RISC-V will support large code model in LLVM 21 - // https://github.com/llvm/llvm-project/pull/70308 +#if JL_LLVM_VERSION >= 200000 + codemodel = CodeModel::Large; +#else codemodel = CodeModel::Medium; +#endif } // Generate simpler code for JIT Reloc::Model relocmodel = Reloc::Static; From 1b4935715385ac21b8eb9de993014955be2c8b3b Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Thu, 24 Jul 2025 19:33:46 +0200 Subject: [PATCH 2/2] Simplify. --- src/jitlayers.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index 8c8ecbe2d2580..460ba016c95be 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -1385,13 +1385,13 @@ namespace { #endif if (TheTriple.isAArch64()) codemodel = CodeModel::Small; +#if JL_LLVM_VERSION < 200000 else if (TheTriple.isRISCV()) { -#if JL_LLVM_VERSION >= 200000 - codemodel = CodeModel::Large; -#else + // RISC-V only supports large code model from LLVM 20 + // https://github.com/llvm/llvm-project/pull/70308 codemodel = CodeModel::Medium; -#endif } +#endif // Generate simpler code for JIT Reloc::Model relocmodel = Reloc::Static; if (TheTriple.isRISCV()) {