From b531d984c8019cebbba21475b17ff0b27a18dc81 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 29 Dec 2016 16:10:39 +0700 Subject: [PATCH] backend/build: add hack to workaround missing interop features --- backend.native/LlvmHacks.h | 9 +++++++++ backend.native/build.gradle | 1 + 2 files changed, 10 insertions(+) create mode 100644 backend.native/LlvmHacks.h diff --git a/backend.native/LlvmHacks.h b/backend.native/LlvmHacks.h new file mode 100644 index 00000000000..355cb661bee --- /dev/null +++ b/backend.native/LlvmHacks.h @@ -0,0 +1,9 @@ +typedef int32_t LLVMAttributeSet; + +// Return value type of LLVMGetFunctionAttr is enum LLVMAttribute; +// it is not a strict enum, but used as a set of enum values instead. +// Currently it is not possible to configure interop to treat a enum in such way, +// so redeclare the function with appropriate return value type: +static inline LLVMAttributeSet LLVMGetFunctionAttrSet(LLVMValueRef Fn) { + return LLVMGetFunctionAttr(Fn); +} \ No newline at end of file diff --git a/backend.native/build.gradle b/backend.native/build.gradle index 97047f7f213..bdeb6b50811 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -134,6 +134,7 @@ List llvmLinkerOpts() { kotlinNativeInterop { llvm { defFile 'llvm.def' + headers files('LlvmHacks.h') compilerOpts "-fPIC", "-I$llvmDir/include" linkerOpts llvmLinkerOpts() }