From 355dd4af1d13f4a79c1fef770069ebc55a568035 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Tue, 3 Dec 2019 15:59:59 +0300 Subject: [PATCH] Fixed visibility problem on ios_arm64 --- .../kotlin/backend/konan/CompilerOutput.kt | 3 ++- .../jetbrains/kotlin/backend/konan/KonanConfig.kt | 5 ++++- runtime/build.gradle | 8 ++++++++ .../exceptions_support/cpp/ExceptionsSupport.cpp | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 runtime/src/exceptions_support/cpp/ExceptionsSupport.cpp diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CompilerOutput.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CompilerOutput.kt index 7fdba5a1b49..47c24fb2b83 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CompilerOutput.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CompilerOutput.kt @@ -68,7 +68,8 @@ private fun linkAllDependencies(context: Context, generatedBitcodeFiles: List = + internal val exceptionsSupportNativeLibrary: String = + File(distribution.defaultNatives(target)).child("exceptionsSupport.bc").absolutePath + + internal val nativeLibraries: List = configuration.getList(KonanConfigKeys.NATIVE_LIBRARY_FILES) internal val includeBinaries: List = diff --git a/runtime/build.gradle b/runtime/build.gradle index 813a9b80942..9e2bc0d5694 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -23,6 +23,7 @@ targetList.each { targetName -> dependsOn "${targetName}Relaxed" dependsOn "${targetName}ProfileRuntime" dependsOn "${targetName}ObjC" + dependsOn "${targetName}ExceptionsSupport" target targetName includeRuntime(delegate) linkerArgs project.file("../common/build/$targetName/hash.bc").path @@ -42,6 +43,13 @@ targetList.each { targetName -> includeRuntime(delegate) } + task ("${targetName}ExceptionsSupport", type: CompileCppToBitcode) { + name "exceptionsSupport" + srcRoot file('src/exceptions_support') + target targetName + includeRuntime(delegate) + } + task ("${targetName}Release", type: CompileCppToBitcode) { name "release" srcRoot file('src/release') diff --git a/runtime/src/exceptions_support/cpp/ExceptionsSupport.cpp b/runtime/src/exceptions_support/cpp/ExceptionsSupport.cpp new file mode 100644 index 00000000000..234df5de640 --- /dev/null +++ b/runtime/src/exceptions_support/cpp/ExceptionsSupport.cpp @@ -0,0 +1,15 @@ +#include "Memory.h" +#include "Porting.h" +#include + +#ifndef KONAN_NO_EXCEPTIONS + +std::type_info const* ExceptionObjHolderRTTI; + +// Just some DCE-surviving code referencing RTTI of ExceptionObjHolder. +// This is needed during compilation to cache. +void referenceExceptionObjHolderRTTI() { + ExceptionObjHolderRTTI = &typeid(ExceptionObjHolder); +} + +#endif \ No newline at end of file