From ad33b8dec5435efdad700f69150d563d5405cd97 Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Mon, 21 Aug 2023 08:32:30 +0900 Subject: [PATCH] Fix builds for LLVM --- llvm/samples/llvm/OrcJit.java | 9 ++++++--- .../src/gen/java/org/bytedeco/llvm/global/LLVM.java | 13 ++++--------- .../main/java/org/bytedeco/llvm/presets/LLVM.java | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/llvm/samples/llvm/OrcJit.java b/llvm/samples/llvm/OrcJit.java index 0194e123027..bb64d360444 100644 --- a/llvm/samples/llvm/OrcJit.java +++ b/llvm/samples/llvm/OrcJit.java @@ -21,10 +21,12 @@ */ import org.bytedeco.javacpp.IntPointer; +import org.bytedeco.javacpp.Loader; import org.bytedeco.javacpp.LongPointer; import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.PointerPointer; import org.bytedeco.libffi.ffi_cif; +import org.bytedeco.llvm.global.LLVM; import org.bytedeco.llvm.LLVM.LLVMBasicBlockRef; import org.bytedeco.llvm.LLVM.LLVMBuilderRef; import org.bytedeco.llvm.LLVM.LLVMContextRef; @@ -90,22 +92,23 @@ public static void main(String[] args) { // Stage 3: Execute using OrcJIT LLVMOrcLLJITRef jit = new LLVMOrcLLJITRef(); LLVMOrcLLJITBuilderRef jitBuilder = LLVMOrcCreateLLJITBuilder(); + Loader.loadGlobal(Loader.load(LLVM.class)); if ((err = LLVMOrcCreateLLJIT(jit, jitBuilder)) != null) { - System.err.println("Failed to create LLJIT: " + LLVMGetErrorMessage(err)); + System.err.println("Failed to create LLJIT: " + LLVMGetErrorMessage(err).getString()); LLVMConsumeError(err); return; } LLVMOrcJITDylibRef mainDylib = LLVMOrcLLJITGetMainJITDylib(jit); if ((err = LLVMOrcLLJITAddLLVMIRModule(jit, mainDylib, threadModule)) != null) { - System.err.println("Failed to add LLVM IR module: " + LLVMGetErrorMessage(err)); + System.err.println("Failed to add LLVM IR module: " + LLVMGetErrorMessage(err).getString()); LLVMConsumeError(err); return; } final LongPointer res = new LongPointer(1); if ((err = LLVMOrcLLJITLookup(jit, res, "sum")) != null) { - System.err.println("Failed to look up 'sum' symbol: " + LLVMGetErrorMessage(err)); + System.err.println("Failed to look up 'sum' symbol: " + LLVMGetErrorMessage(err).getString()); LLVMConsumeError(err); return; } diff --git a/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java b/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java index 297fb2f0908..9552f27278f 100644 --- a/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java +++ b/llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java @@ -10414,12 +10414,7 @@ public static native LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForP * THIS API IS EXPERIMENTAL AND LIKELY TO CHANGE IN THE NEAR FUTURE! * */ -public static native LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath( - @ByPtrPtr LLVMOrcDefinitionGeneratorRef Result, LLVMOrcObjectLayerRef ObjLayer, - @Cast("const char*") BytePointer FileName, @Cast("const char*") BytePointer TargetTriple); -public static native LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath( - @Cast("LLVMOrcDefinitionGeneratorRef*") PointerPointer Result, LLVMOrcObjectLayerRef ObjLayer, - String FileName, String TargetTriple); + /** * Create a ThreadSafeContext containing a new LLVMContext. @@ -11563,16 +11558,16 @@ public static native void LLVMPassBuilderOptionsSetInlinerThreshold( // #include "llvm/ExecutionEngine/ExecutionEngine.h" // #include "llvm/Target/TargetMachine.h" // #include "llvm/Transforms/IPO.h" -// #include "llvm/Transforms/IPO/PassManagerBuilder.h" +//#include "llvm/Transforms/IPO/PassManagerBuilder.h" // #include "llvm/IR/Verifier.h" // #include "llvm/IR/LegacyPassManager.h" // #include "llvm/CodeGen/TargetPassConfig.h" // #include "llvm/MC/TargetRegistry.h" // #include "llvm/Analysis/TargetLibraryInfo.h" // #include "llvm/Analysis/TargetTransformInfo.h" -// #include "llvm/MC/SubtargetFeature.h" +//#include "llvm/MC/SubtargetFeature.h" // #include "llvm/Pass.h" -// #include "llvm-c/Transforms/PassManagerBuilder.h" +//#include "llvm-c/Transforms/PassManagerBuilder.h" // #include "llvm-c/Types.h" // #include "llvm-c/Error.h" diff --git a/llvm/src/main/java/org/bytedeco/llvm/presets/LLVM.java b/llvm/src/main/java/org/bytedeco/llvm/presets/LLVM.java index 0119b00b283..d33fd24644f 100644 --- a/llvm/src/main/java/org/bytedeco/llvm/presets/LLVM.java +++ b/llvm/src/main/java/org/bytedeco/llvm/presets/LLVM.java @@ -192,6 +192,6 @@ public void map(InfoMap infoMap) { .put(new Info("defined(_MSC_VER) && !defined(inline)", "GPU_CODEGEN").define(false)) .put(new Info("LLVMErrorTypeId").annotations("@Const").valueTypes("LLVMErrorTypeId")) .put(new Info("llvm::raw_ostream").cast().pointerTypes("Pointer")) - .put(new Info("LLVMOrcObjectLayerAddObjectFileWithRT").skip()); + .put(new Info("LLVMOrcObjectLayerAddObjectFileWithRT", "LLVMOrcCreateStaticLibrarySearchGeneratorForPath").skip()); } }