Commit Graph

63 Commits

Author SHA1 Message Date
Sergey Bogolepov b37cdae966 [K/N] Fix KT-47911
Specify target-cpu when compiling for AArch64 Darwin targets, because
Apple's CPU might execute "movi.2d vD, #0" incorrectly.

See https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171218/511205.html.
2021-08-03 05:54:35 +00:00
Sergey Bogolepov 7d8360f38b [K/N] Set target-features for host targets
Benchmarks on CI show that there are some performance regressions after
LLVM update due to worse inliner results. Explicit specification of
target-features fixes the problem. Interestingly, it seems that this is
not required for Darwin AArch64 target.
2021-08-03 05:42:08 +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 6e093b0beb [K/N] Update libffi for Windows
MinGW and MSVC are hardly compatible in case of static linkage, so we
need to use a native libffi.
2021-08-03 05:42:06 +00:00
Sergey Bogolepov a525f3f357 [K/N] Fix path to ld.gold on Windows
targetToolchain.mingw_x64-linux_* are changed, so we should their usages
Probably, we could switch to LLD, but it requires additional testing.
2021-08-03 05:42:05 +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 0d39442a5e [K/N] Update linux_arm32_hfp llvm target features
Set of target features has changed between LLVM 8 and LLVM 11.
Update the list for linux_arm32_hfp to make clang stop complaining.
2021-08-03 05:42:03 +00:00
Sergey Bogolepov 1c7a27ce42 [K/N] Fix mxgot flag for MIPS
It was dropped from cc1 interface, so use -target-feature +xgot instead.
2021-08-03 05:42:03 +00:00
Sergey Bogolepov e8b025f267 [K/N] Drop obsolete --no-threads LLD flags
--no-threads flag was used, because LLD had deadlock long time ago.
This flag is removed from LLD (in favor of --threads=N) and it looks
like that the bug is gone now. So we can just drop --no-threads flag!
2021-08-03 05:42:03 +00:00
Sergey Bogolepov 023c775188 [K/N] Bump macOS minimal version 2021-08-03 05:42:01 +00:00
Sergey Bogolepov 7dda04a1c9 [K/N] Update LLVM distributions to 11.1.0
This commit is important for several reasons:
1. Finally, LLVM update from 8.0.0 to 11.1.0
At the time of writing, LLVM 12.0.0 already came out, but we need to be
compatible with LLVM from Xcode 12.5, so that's why we stick to a bit
older version of LLVM.
2. These LLVM distributions are built with tools/llvm_builder/package.py
We finally managed to introduce an explicit process of building our LLVM
distributions, so we will be able to updated them more frequently and
adapt to our needs.
3. Native Windows LLVM instead of MinGW
Last but not least, we now use native Windows LLVM distribution. While
it might be harder to use (no more posix everywhere), simpler build
process (building msys2 is not that easy) and no need for MinGW-specific
patches makes such distribution way more convenient.
2021-08-03 05:42:00 +00:00
Sergey Bogolepov 44256db824 [K/N] Update minimal Xcode version
The next LLVM version will be 11.1.0, and we need to be sure that
Xcode supports bitcode of this version. So we bump minimal Xcode version
to 12.5, which should be OK, because by the time Kotlin 1.6.0 comes out,
Xcode 12.5 will be around 6 month old.

Also this commit simplifies tarball naming.
2021-08-03 05:42:00 +00:00
Dmitriy Dolovov 66c9d658e4 [K/N] Keep the Kotlin/Native compiler version inside of the K/N distribution
Restore the behavior that was accidentally disabled.
2021-07-29 12:56:50 +03: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 e396da0562 [K/N] Update list of targets with stable caches
Enable compiler caches for iosSimulatorArm64 and macosArm64 targets
to make Apple Silicon distribution feature complete with
Intel-based one.
2021-07-06 18:15:30 +03:00
Pavel Kunyavskiy 70ca222806 [K/N] Disable external calls checker for wasm target 2021-07-05 18:49:09 +00:00
Alexander Shabalin c286a9d8c6 Extract StackTrace from Exceptions 2021-07-01 07:23:47 +00:00
Pavel Kunyavskiy abf6ae70e2 [K/N] Add workaround options to arm64 targets 2021-06-30 13:47:28 +00:00
Elena Lepilkina 85ecbcb8f0 [K/N] Changed inlineThreshold after BCE for varargs 2021-06-24 12:57:57 +00:00
Kirill Shmakov 5fdbcb3dd1 [K/N][debug] Update LLDB bundle to support Apple Silicon
This is related to KTIJ-18889
2021-06-23 15:13:05 +03:00
Sergey Bogolepov 4f98a0e083 [Native] Introduce optInCacheableTargets
Create an explicit list of targets that have unstable compiler caches
in konan.properties. It allows to control all lists of cacheable targets
in a single place.
2021-06-17 09:19:44 +00:00
Elena Lepilkina 7f591bcfd4 [K/N] Changed llvmInlineThreshold for new form of bitcode 2021-05-24 15:46:21 +00:00
Sergey Bogolepov cc4adb798f Add cacheable targets for macos_arm64 host. 2021-04-27 13:47:20 +00:00
Sergey Bogolepov 0fa2821ac1 Add missing targetToolchain.macos_arm64-linux_arm32_hfp property 2021-04-09 18:26:23 +07:00
Sergey Bogolepov 6ab38c1ff8 Add support for Apple Silicon simulators 2021-04-08 16:51:51 +03: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 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
Sergey Bogolepov f1280a63d3 Remove -target-cpu flag from Mac targets
Because this option is unsupported in
bitcode embedding.
2021-03-29 12:17:12 +07:00
Sergey Bogolepov 5243720043 Add support for android and wasm on macos_arm64 2021-03-24 17:37:51 +03:00
Sergey Bogolepov 30863cd184 Support the rest of Linux targets on macos_arm64 2021-03-24 17:37:45 +03:00
Sergey Bogolepov 0e1276fc6c Support the rest of Apple targets on macos_arm64 2021-03-24 17:37:44 +03:00
Sergey Bogolepov 58e0cc1c7c Specify linker for macos_arm64-linux_x64 2021-03-24 17:37:42 +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 8ba4f060f0 Enable linuxX64 target on macOsArm64 host
Because tests for Gradle plugin assumes that linuxX64
is available on all hosts.
2021-03-22 14:02:43 +03:00
Sergey Bogolepov 7e18b69e7d Add initial support for macos_arm64 host 2021-03-22 14:02:41 +03:00
Sergey Bogolepov f5f7e976f6 Fix #KT-45094
Rebuild linux toolchains with an older OS.

(cherry picked from commit 1d249ad7b592573dc4478f0f6cefe2766c323e12)
2021-03-09 20:19:33 +00:00
Alexander Shabalin a38e64a7c8 Update runtimeDefinitions after toolchain upgrade (#4714) 2021-02-24 11:00:05 +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 70832b16a3 Fix KT-44774 2021-02-15 10:16:10 +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
Sergey Bogolepov 780adc4163 Fix mingw-linux_arm32_hfp cross-compilation
Use gold linker instead of default one since the latter doesn't support elf.
2021-01-12 15:09:31 +03:00
Sergey Bogolepov 2df2c2f055 Fix compilation of executable for linux_mips32 2020-12-21 16:18:37 +01:00
Sergey Bogolepov 0f733b6baf Move linker selection to konan.properties 2020-12-21 16:18:37 +01:00
Sergey Bogolepov e8e705bf68 Introduce property for relocation mode 2020-12-21 16:18:37 +01:00
Sergey Bogolepov 3068c230f9 Enable caches for linux_x64 2020-12-21 16:18:37 +01:00
Sergey Bogolepov ecd3ea261c Move crt* files location to konan.properties 2020-12-14 15:31:10 +01:00
Sergey Bogolepov 61ece4d364 Cleanup Linker.kt a little 2020-12-14 15:31:10 +01:00
Sergey Bogolepov 6565d18a9f Use gold linker instead of lld on Windows and Linux
lld is doing something wrong for linux_arm32_hfp and linux_arm64 targets, so we fallback to gold linker on Linux and Windows.
See KT-41725 and KT-42446
2020-12-14 15:31:10 +01:00
Sergey Bogolepov ddaf477849 Support new linux_arm32_hfp_toolchain 2020-12-14 15:31:10 +01:00