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() }