Commit Graph

88 Commits

Author SHA1 Message Date
Sergey Bogolepov 34cb79fc9f [K/N] Fix KT-50970
Force generation of ARM instruction set for iosArm32 and
watchosArm32 targets for C++ code. There is no need for such
adjustments for Kotlin code because we don't specify any target
features in IrToBitcode and compiler backend infers target features
from target architecture (which is armv7* and not thumbv7).
2022-02-14 13:38:49 +00:00
Svyatoslav Scherbina 5afbbecea4 Native: rename Xcode.current to .findCurrent()
To reflect that it is a non-trivial operation with possible performance
overhead.
2022-02-14 08:52:14 +00:00
Svyatoslav Scherbina e92f7b5ec3 Native: don't cache Xcode.current between different compiler invocations
The compiler might be executed in a Gradle daemon process,
so current Xcode might actually change between different invocations.

^KT-49496 Fixed
2022-02-14 08:52:13 +00:00
Svyatoslav Scherbina 86ad804848 Native: remove support for pre-Xcode 12 libclang_rt
Kotlin/Native doesn't support Xcode versions older than 12.5 anymore,
so just remove the obsolete code.
2022-02-14 08:52:13 +00:00
Svyatoslav Scherbina eb78f5e1ca Native: make xcrun failures a bit more useful again
^KT-50923
2022-02-09 12:46:19 +00:00
Svyatoslav Scherbina 1d3e72cef4 Native: do not cache DependencyProcessor.localKonanDir
Caching is wrong when the compiler is working in Gradle daemon, because
the daemon can change the environment, while localKonanDir depends on
the environment.
2022-01-26 12:43:41 +00:00
sebastian.sellmair 0fd65ab1a0 [Native] TargetedLibraryImpl: Respect 'commonizerNativeTargets' property
^KT-50847 Verification Pending
2022-01-25 16:59:27 +00:00
Igor Chevdar bd6ea71ead [K/N][gradle][interop] Refactored ToolConfig
Added possibility to create different strategies for loading libclang
2022-01-14 10:29:10 +05:00
Sergey Bogolepov 10b48296e8 [K/N] Fix FrameworkTest in case of simulator target
As of Xcode 13.1 Swift 5.5 passes wrong libclang_rt to simulator targets
(similar to ours KT-47333). To workaround this problem, we explicitly
provide the correct one.
2021-12-01 08:49:51 +00:00
Igor Chevdar 4b53a8e3c7 Revert "[K/N][gradle][interop] Refactored ToolConfig"
This reverts commit d9c1b1f6f7.
2021-11-26 14:01:40 +05:00
Igor Chevdar d9c1b1f6f7 [K/N][gradle][interop] Refactored ToolConfig
Added possibility to create different strategies for loading libclang
2021-11-25 23:42:10 +05:00
Sergey Bogolepov 4c45f71edb [K/N] Fix KT-49876
Use llvm-ar on Windows host when producing Linux static library.
2021-11-25 09:28:03 +00:00
Martin Petrov 416d12bce8 [Native] Lazily create dependency & cache directories. (#4627)
Previously initializing the DependencyProcessor will result in file IO.

In a fully-hermetic environment where all dependencies are local, this IO is redundant and may require the build system (e.g. Bazel) to do extra setup to ensure there is a local writable directory specified for these directories. This change will instead cause the dependency processor to bail early and skip downloading dependencies if all are local anyway.

Prior to this change kicking off a clean build with local dependencies would result in:

```
rm -rf ~/.konan/cache; fswatch -ax ~/.konan
~/.konan/cache Created IsDir
~/.konan/cache/.lock Created IsFile
```

After the change no FS operations are performed.
2021-11-09 11:30:30 +03:00
Mattia Iavarone c92e34ca9f [Native] Enable real Android Native executables (#4624)
* Add AndroidProgramType binary option, override entry point, fix linker flags

* Add Konan_main_standalone entry point to the Android runtime

* Add compiler warning

* Make standalone programs print to stdout

* Fix warning message and readability
2021-10-26 11:33:17 +07:00
Sergey Bogolepov 48a26204a7 [K/N] Make xcrun failures a bit more useful 2021-10-02 09:16:53 +00:00
Pavel Punegov ae1288948a [K/N] Exclude libbacktrace for Linux-MIPS targets
See #KT-48949
2021-10-01 10:59:16 +00:00
Pavel Kunyavskiy e15cfe8f70 [K/N] Use gradle-level conditional compilation for core symbolication 2021-09-29 07:00:07 +00:00
Pavel Kunyavskiy 9f2035c43d [K/N] Don't assume all apple target support CoreSymbolication 2021-09-29 07:00:07 +00:00
Pavel Kunyavskiy 91dd9dc9b0 [K/N] Add libbacktrace 2021-09-20 11:28:06 +00:00
Elena Lepilkina e454c824d5 [K/N] Enable mimalloc support on Windows and Mac Arm64 2021-09-08 13:53:17 +00:00
Sergey Bogolepov 254fc53b17 [K/N] Disable mimalloc for MinGW on Linux and Windows
There is a case-sensitivity problem when cross-compiling to MinGW.
https://github.com/microsoft/mimalloc/commit/71ac98a fixes the problem,
but it is not included into our current version of mimalloc.
2021-08-23 16:01:37 +00:00
Sergey Bogolepov c50ae1ffe6 [K/N] Don't check for MSVC on Linux and macOS hosts 2021-08-23 16:01:36 +00:00
Sergey Bogolepov 1315fdaf56 [K/N] Proper MinGW cross-compilation support 2021-08-23 16:01:36 +00:00
Sergey Bogolepov db9ff9a4ce [K/N] Remove obsolete hack
Besides obsolescence, this hack is not working for "user" LLVM variant.
2021-08-23 10:13:35 +00:00
Alexander Udalov 376b420d1a Fix warnings in JS/WASM modules 2021-08-06 22:36:22 +02:00
Sergey Bogolepov 4c58954967 [K/N] Don't perform --gc-sections when producing DLL
Due to a bug, lld-link might be a bit too aggressive.
Let's disable --gc-sections for DLL until we update LLD.
Patches:
https://reviews.llvm.org/D101522
https://reviews.llvm.org/D101615
https://reviews.llvm.org/D102138
2021-08-04 14:50:58 +00:00
Sergey Bogolepov c7c78e0e1a [K/N] Use LLD 12.0.1 for MinGW targets
Clang-produced and GCC-produced binaries might be ABI-incompatible on
MinGW. Explanation on GitHub: msys2/MINGW-packages/issues/6855#issuecomment-680859662.
TL;DR: GCC-generated sections are 16-byte-padded, while Clang ones are
not. It causes problems during merge of COMDAT sections.
I observed the problem during compilation of runtime tests, but it is
possible that the problem could affect main compilation pipeline as well.
https://reviews.llvm.org/D86659 (which landed in LLVM 12) fixes
the problem. So we have another motivation for switching to LLD besides
https://youtrack.jetbrains.com/issue/KT-47605.

The only known downside is unsupported defsym which causes slight binary
size increase. I think it is doable.
2021-08-03 05:42:06 +00:00
Sergey Bogolepov 66ddd15798 [K/N] Support compiler compilation in MSVC environment
The right way is to add something like KonanTarget.MSVC_X64, but doing
so requires changes throughout whole compiler. It would be especially
painful in HostManager, where we would need to deprecate
KonanTarget.MINGW_X64 as host. Instead we "hack" ClangArgs to compile
for x86_64-pc-windows-msvc instead of x86_64-pc-windows-gnu in JNI case.

CI may contain custom MSVC and Windows Kit installation path, so we
should support it. Things might break when machine has several MSVC
installed (at custom and default path), but it sounds more like
incorrect environment setup problem than ours.
2021-08-03 05:42:05 +00:00
Sergey Bogolepov a78fcd6b64 [K/N] Separate ClangArgs for jni and native
Since LLVM for Windows is now native instead on MinGW, we have to
compile code in a different environment in case of JNI. This commits
just separates ClangArgs into two subclasses without actual behavior
changes.
2021-08-03 05:42:05 +00:00
Sergey Bogolepov fbbbc1c092 [K/N] Drop Configurables interface for ClangArgs
ClangArgs abused delegation mechanism and it complicated its interface.
2021-08-03 05:42:04 +00:00
Sergey Bogolepov 572f08151a [K/N] Disable code coverage testing
Since LLVM 8, coverage format has changed.
We don't officially provide code coverage for end-users, so it's ok to
disable it for now and fix later.
2021-08-03 05:42:02 +00:00
Sergey Bogolepov bce1075fc4 [K/N] Prepare MinGW linker for LLVM 11
Explicitly set sysroot, target and linker when linking MinGW binary
because it won't be the default target after LLVM update.
2021-07-23 04:51:52 +00:00
Elena Lepilkina 609296a46b [K/N] Use libclang_rt version for simulator for last Xcode versions (KT-47333 fixed) 2021-07-19 14:12:41 +00:00
Sergey Bogolepov 118889add5 [K/N] Fix mingw_x86 compilation
It was broken in 9ed97a27f1.
2021-07-15 04:55:36 +00:00
Sergey Bogolepov 9ed97a27f1 [K/N] Introduce LLD compatibility checker for MinGW
We are going to switch to LLD linker for MinGW targets.
Right now LLD for MinGW doesn't support all features
of ld.bfd and thus this change might be breaking for some users.
To make transition smoother, we run lld -### to show a warning to user
so they can update their compilation options before LLD will be turned
on by default.

More details: https://youtrack.jetbrains.com/issue/KT-47605
2021-07-07 07:50:57 +00:00
Sergey Bogolepov 13464cce68 [Native] Adapt Skia interop to ClangArgs refactoring. 2021-04-30 12:07:46 +00:00
Sergey Bogolepov 274d18a141 [Kotlin/Native] Add a workaround for Xcode 12.5
SDKs from Xcode 12.5 contain C++ stdlib and it
breaks compilation of C++ parts of compiler.
Mitigate this problem by explicitly specifying
path to C++ stdlib.
2021-04-30 08:39:26 +00:00
Alexander Gorshenev 887032667d [Kotlin/Native][Interop] Skia interop plugin for cinterop 2021-04-29 21:43:26 +03:00
Sergey Bogolepov 81d4c19d8b Fix Android NDK targets
Android NDK dirs omit vendor part of triple,
so we have to respect its decision.
2021-04-09 13:11:14 +07:00
Sergey Bogolepov 3718907c6a Use -target instead of -arch in ClangArgs
Explicit target selection helps Clang to
 correctly set things up in case of Apple Silicon
 simulator target.
2021-04-08 16:51:49 +03:00
Sergey Bogolepov 790fea635d Avoid explicit native targets enumerations 2021-04-08 16:51:45 +03:00
Sergey Bogolepov 15dcb36f47 Use TargetTriple in backend to simplify code. 2021-04-08 16:51:44 +03:00
Vasily Levchenko d2d324797b [build][xcode][warning][todo] suppress deprecation warning with todo till bootstrap bump 2021-04-08 10:42:44 +02:00
Sergey Bogolepov 437a0aa450 Prepare test infrastructure for Apple Silicon simulators.
* Get rid of explicit target enumerations by using TargetTriple.
* Remove some code duplication with `project.testTargetConfigurables`
2021-04-08 09:18:27 +03:00
Sergey Bogolepov cebf815fed Introduce a proper TargetTriple class.
Target triple (like `arm64-apple-ios-simulator`) is a common
way to represent any target platform.
One of many useful properties: it allows to explicitly
distinguish iOS arm64 simulator target and a real device.
2021-04-08 09:18:25 +03:00
Abduqodiri Qurbonzoda 983985bc68 [K/N] Migrate compiler, interop and others to new case conversion api 2021-04-08 03:22:05 +03:00
Elena Lepilkina 393aaac2b9 [Native] Removed old gradle properties for kotlin repo and versions 2021-04-02 05:42:13 +00:00
Sergey Bogolepov 3a008f6236 Cleanup ClangArgs.kt a little bit 2021-03-24 17:37:50 +03:00
Sergey Bogolepov 273b43d227 Simplify setting apple os version in ClangArgs
Use `osVersionMinFlagClang` from konan.properties
instead of manual setup in ClangArgs.
This simplification will make it easier to add support
for future targets.
2021-03-24 17:37:49 +03:00
Sergey Bogolepov 51d3d1f1a8 ClangArgs: Set stdlib for apple targets in a single place 2021-03-24 17:37:48 +03:00