Commit Graph

75 Commits

Author SHA1 Message Date
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
Sergey Bogolepov f339e9cc66 ClangArgs: Set arch for apple targets in a single place 2021-03-24 17:37:47 +03:00
Sergey Bogolepov 579c1eb7db Remove libffi from target dependencies
Technically, it is a dependency of a compiler itself.
Thus, we can simplify konan.properties a little bit
by applying the same approach as we did for LLVM.
2021-03-24 17:37:40 +03:00
Sergey Bogolepov 7e18b69e7d Add initial support for macos_arm64 host 2021-03-22 14:02:41 +03:00
Sergey Bogolepov 4222fb9629 Remove unused filterGradleNativeSoftwareFlags method 2021-03-22 14:02:40 +03:00
Vasily Levchenko 65dd798818 [build][native support] intoduced new native support. 2021-02-24 11:07:18 +01:00
Vasily Levchenko e031da6e70 [build][dependencies] \r -> \n 2021-02-24 11:07:18 +01:00
Vasily Levchenko c85c3ac123 [build] joint (step 1)
(cherry picked from commit 7d0775f7e69ab900200bcf1fa78b94d68e6bd4f6)
2021-02-24 11:04:59 +01:00
Paul Idstein 3f15774cb2 Fix -Xoverride-konan-properties for Apple strip
When building an optimised release dynamic framework we see a lot of local symbols in Mach-O. When calling `strip -x` this can be dramatically reduced whilst still having a usable artefact.

Current logic seems to keep symbols for DSYM extraction in debug light mode. But only strips hardcoded debug symbols (`strip -S`) afterwards.

Introduce new stripFlags for Apple compilation to allow optimization for release with DSYM builds
2021-02-24 10:53:42 +01:00
Sergey Bogolepov fddf28ac47 Support for macos_arm64 target in backend
(cherry picked from commit 82775e93c1389f21f9be97bd0edfd16dd50300ea)
2021-02-09 09:00:48 +01:00
LepilkinaElena 2331475776 Use klib prefix for temporary directory for klibs (#4686) 2021-02-09 09:00:48 +01:00
Sergey Bogolepov d82109cc92 Fix KT-43502 by adding -fPIC 2021-02-09 09:00:46 +01:00
Vasily Levchenko 8b2f0d644b [build] kotlin.*Compile: -Xskip-prerelease-check
(cherry picked from commit 57172ac6ead928b565fefaf49d8405a07c856e25)
2021-02-01 16:54:15 +01:00
Roman Artemev fde107b181 [KLIB] Adapt new klib io API in K/N
(cherry picked from commit 70fabb6a9db83db5f5b26b54f2656655316ea31c)
2021-02-01 16:54:15 +01:00