Implement C stubs generation in compiler
Use it in * C varargs support (thus dropping libffi from runtime) * C callbacks support (thus enabling callbacks with structs)
This commit is contained in:
committed by
SvyatoslavScherbina
parent
7f2103a0ee
commit
6ca196399a
+16
-24
@@ -36,10 +36,10 @@ llvmVersion = 6.0.1
|
||||
# Mac OS X.
|
||||
llvmHome.macos_x64 = clang-llvm-6.0.1-darwin-macos
|
||||
targetToolchain.macos_x64 = target-toolchain-8-macos_x64
|
||||
libffiDir.macos_x64 = libffi-3.2.1-3-darwin-macos
|
||||
|
||||
arch.macos_x64 = x86_64
|
||||
targetSysRoot.macos_x64 = target-sysroot-8-macos_x64
|
||||
libffiDir.macos_x64 = libffi-3.2.1-3-darwin-macos
|
||||
llvmLtoFlags.macos_x64 =
|
||||
llvmLtoOptFlags.macos_x64 = -O3 -function-sections
|
||||
llvmLtoNooptFlags.macos_x64 = -O1
|
||||
@@ -65,7 +65,7 @@ target-toolchain-8-macos_x64.default = \
|
||||
# Apple's 32-bit iOS.
|
||||
targetToolchain.macos_x64-ios_arm32 = target-toolchain-8-macos_x64
|
||||
dependencies.macos_x64-ios_arm32 = \
|
||||
libffi-3.2.1-3-darwin-ios \
|
||||
libffi-3.2.1-3-darwin-macos \
|
||||
clang-llvm-6.0.1-darwin-macos
|
||||
|
||||
target-sysroot-8-ios_arm32.default = \
|
||||
@@ -75,7 +75,6 @@ arch.ios_arm32 = armv7
|
||||
entrySelector.ios_arm32 = -alias _Konan_main _main
|
||||
# Shared with 64-bit version.
|
||||
targetSysRoot.ios_arm32 = target-sysroot-8-ios_arm64
|
||||
libffiDir.ios_arm32 = libffi-3.2.1-3-darwin-ios
|
||||
llvmLtoFlags.ios_arm32 =
|
||||
llvmLtoOptFlags.ios_arm32 = -O3 -function-sections
|
||||
linkerNoDebugFlags.ios_arm32 = -S
|
||||
@@ -91,7 +90,7 @@ osVersionMin.ios_arm32 = 9.0
|
||||
# Apple's 64-bit iOS.
|
||||
targetToolchain.macos_x64-ios_arm64 = target-toolchain-8-macos_x64
|
||||
dependencies.macos_x64-ios_arm64 = \
|
||||
libffi-3.2.1-3-darwin-ios \
|
||||
libffi-3.2.1-3-darwin-macos \
|
||||
clang-llvm-6.0.1-darwin-macos
|
||||
|
||||
target-sysroot-8-ios_arm64.default = \
|
||||
@@ -100,7 +99,6 @@ target-sysroot-8-ios_arm64.default = \
|
||||
arch.ios_arm64 = arm64
|
||||
entrySelector.ios_arm64 = -alias _Konan_main _main
|
||||
targetSysRoot.ios_arm64 = target-sysroot-8-ios_arm64
|
||||
libffiDir.ios_arm64 = libffi-3.2.1-3-darwin-ios
|
||||
llvmLtoFlags.ios_arm64 =
|
||||
llvmLtoOptFlags.ios_arm64 = -O3 -function-sections
|
||||
linkerNoDebugFlags.ios_arm64 = -S
|
||||
@@ -116,7 +114,7 @@ osVersionMin.ios_arm64 = 9.0
|
||||
# Apple's iOS simulator.
|
||||
targetToolchain.macos_x64-ios_x64 = target-toolchain-8-macos_x64
|
||||
dependencies.macos_x64-ios_x64 = \
|
||||
libffi-3.2.1-2-darwin-ios_sim \
|
||||
libffi-3.2.1-3-darwin-macos \
|
||||
clang-llvm-6.0.1-darwin-macos
|
||||
|
||||
target-sysroot-8-ios_x64.default = \
|
||||
@@ -125,7 +123,6 @@ target-sysroot-8-ios_x64.default = \
|
||||
arch.ios_x64 = x86_64
|
||||
entrySelector.ios_x64 = -alias _Konan_main _main
|
||||
targetSysRoot.ios_x64 = target-sysroot-8-ios_x64
|
||||
libffiDir.ios_x64 = libffi-3.2.1-2-darwin-ios_sim
|
||||
llvmLtoFlags.ios_x64 =
|
||||
llvmLtoOptFlags.ios_x64 = -O3 -function-sections
|
||||
llvmLtoNooptFlags.ios_x64 = -O1
|
||||
@@ -142,10 +139,10 @@ osVersionMin.ios_x64 = 9.0
|
||||
llvmHome.linux_x64 = clang-llvm-6.0.1-linux-x86-64
|
||||
gccToolchain.linux_x64 = target-gcc-toolchain-3-linux-x86-64
|
||||
targetToolchain.linux_x64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu
|
||||
libffiDir.linux_x64 = libffi-3.2.1-2-linux-x86-64
|
||||
|
||||
quadruple.linux_x64 = x86_64-unknown-linux-gnu
|
||||
targetSysRoot.linux_x64 = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot
|
||||
libffiDir.linux_x64 = libffi-3.2.1-2-linux-x86-64
|
||||
# targetSysroot-relative.
|
||||
libGcc.linux_x64 = ../../lib/gcc/x86_64-unknown-linux-gnu/4.8.5
|
||||
llvmLtoFlags.linux_x64 =
|
||||
@@ -174,8 +171,7 @@ dependencies.linux_x64-linux_arm32_hfp = \
|
||||
clang-llvm-6.0.1-linux-x86-64 \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
target-sysroot-1-raspberrypi \
|
||||
libffi-3.2.1-2-linux-x86-64 \
|
||||
libffi-3.2.1-2-raspberrypi
|
||||
libffi-3.2.1-2-linux-x86-64
|
||||
|
||||
quadruple.linux_arm32_hfp = armv6-unknown-linux-gnueabihf
|
||||
entrySelector.linux_arm32_hfp = --defsym main=Konan_main
|
||||
@@ -184,7 +180,6 @@ linkerDynamicFlags.linux_arm32_hfp = -shared
|
||||
linkerOptimizationFlags.linux_arm32_hfp = --gc-sections
|
||||
targetSysRoot.linux_arm32_hfp = target-sysroot-1-raspberrypi
|
||||
# We could reuse host toolchain here.
|
||||
libffiDir.linux_arm32_hfp = libffi-3.2.1-2-raspberrypi
|
||||
linkerKonanFlags.linux_arm32_hfp = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
--defsym __cxa_demangle=Konan_cxa_demangle
|
||||
# targetSysroot-relative.
|
||||
@@ -207,8 +202,7 @@ dependencies.linux_x64-linux_mips32 = \
|
||||
target-gcc-toolchain-2-linux-mips \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
target-sysroot-2-mips \
|
||||
libffi-3.2.1-2-linux-x86-64 \
|
||||
libffi-3.2.1-2-linux-mips
|
||||
libffi-3.2.1-2-linux-x86-64
|
||||
|
||||
quadruple.linux_mips32 = mips-unknown-linux-gnu
|
||||
entrySelector.linux_mips32 = --defsym main=Konan_main
|
||||
@@ -216,7 +210,6 @@ linkerOptimizationFlags.linux_mips32 = --gc-sections
|
||||
linkerDynamicFlags.linux_mips32 = -shared
|
||||
targetSysRoot.linux_mips32 = target-sysroot-2-mips
|
||||
# We could reuse host toolchain here.
|
||||
libffiDir.linux_mips32 = libffi-3.2.1-2-linux-mips
|
||||
linkerKonanFlags.linux_mips32 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
--defsym __cxa_demangle=Konan_cxa_demangle -z notext
|
||||
# targetSysroot-relative.
|
||||
@@ -236,15 +229,13 @@ dependencies.linux_x64-linux_mipsel32 = \
|
||||
target-gcc-toolchain-2-linux-mips \
|
||||
target-gcc-toolchain-3-linux-x86-64 \
|
||||
target-sysroot-2-mipsel \
|
||||
libffi-3.2.1-2-linux-x86-64 \
|
||||
libffi-3.2.1-2-linux-mipsel
|
||||
libffi-3.2.1-2-linux-x86-64
|
||||
quadruple.linux_mipsel32 = mipsel-unknown-linux-gnu
|
||||
entrySelector.linux_mipsel32 = --defsym main=Konan_main
|
||||
linkerOptimizationFlags.linux_mipsel32 = --gc-sections
|
||||
linkerDynamicFlags.linux_mipsel32 = -shared
|
||||
targetSysRoot.linux_mipsel32 = target-sysroot-2-mipsel
|
||||
# We could reuse host toolchain here.
|
||||
libffiDir.linux_mipsel32 = libffi-3.2.1-2-linux-mipsel
|
||||
linkerKonanFlags.linux_mipsel32 = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread \
|
||||
--defsym __cxa_demangle=Konan_cxa_demangle -z notext
|
||||
# targetSysroot-relative.
|
||||
@@ -264,13 +255,13 @@ dependencies.macos_x64-android_arm32 = \
|
||||
clang-llvm-6.0.1-darwin-macos \
|
||||
target-sysroot-21-android_arm32 \
|
||||
target-toolchain-21-osx-android_arm32 \
|
||||
libffi-3.2.1-2-android_arm32
|
||||
libffi-3.2.1-3-darwin-macos
|
||||
targetToolchain.linux_x64-android_arm32 = target-toolchain-21-linux-android_arm32
|
||||
dependencies.linux_x64-android_arm32 = \
|
||||
clang-llvm-6.0.1-linux-x86-64 \
|
||||
target-sysroot-21-android_arm32 \
|
||||
target-toolchain-21-linux-android_arm32 \
|
||||
libffi-3.2.1-2-android_arm32
|
||||
libffi-3.2.1-2-linux-x86-64
|
||||
|
||||
quadruple.android_arm32 = arm-linux-androideabi
|
||||
entrySelector.android_arm32 = -Wl,--defsym -Wl,main=Konan_main
|
||||
@@ -279,7 +270,6 @@ llvmLtoOptFlags.android_arm32 = -O3 -function-sections
|
||||
linkerNoDebugFlags.android_arm32 = -Wl,-S
|
||||
llvmLtoNooptFlags.android_arm32 = -O1
|
||||
targetSysRoot.android_arm32 = target-sysroot-21-android_arm32
|
||||
libffiDir.android_arm32 = libffi-3.2.1-2-android_arm32
|
||||
linkerKonanFlags.android_arm32 = -lm -latomic -lstdc++ -landroid
|
||||
|
||||
# Android ARM64, based on NDK for android-21.
|
||||
@@ -289,29 +279,28 @@ dependencies.macos_x64-android_arm64 = \
|
||||
clang-llvm-6.0.1-darwin-macos \
|
||||
target-sysroot-21-android_arm64 \
|
||||
target-toolchain-21-osx-android_arm64 \
|
||||
libffi-3.2.1-2-android_arm64
|
||||
libffi-3.2.1-3-darwin-macos
|
||||
targetToolchain.linux_x64-android_arm64 = target-toolchain-21-linux-android_arm64
|
||||
dependencies.linux_x64-android_arm64 = \
|
||||
clang-llvm-6.0.1-linux-x86-64 \
|
||||
target-sysroot-21-android_arm64 \
|
||||
target-toolchain-21-linux-android_arm64 \
|
||||
libffi-3.2.1-2-android_arm64
|
||||
libffi-3.2.1-2-linux-x86-64
|
||||
|
||||
quadruple.android_arm64 = aarch64-linux-android
|
||||
entrySelector.android_arm64 = -Wl,--defsym -Wl,main=Konan_main
|
||||
llvmLtoFlags.android_arm64 = -emulated-tls -relocation-model=pic
|
||||
targetSysRoot.android_arm64 = target-sysroot-21-android_arm64
|
||||
libffiDir.android_arm64 = libffi-3.2.1-2-android_arm64
|
||||
linkerKonanFlags.android_arm64 = -lm -latomic -lstdc++ -landroid
|
||||
linkerNoDebugFlags.android_arm64 = -Wl,-S
|
||||
|
||||
# Windows x86-64, based on mingw-w64.
|
||||
llvmHome.mingw_x64 = msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1
|
||||
targetToolchain.mingw_x64 = msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1
|
||||
libffiDir.mingw_x64 = libffi-3.2.1-mingw-w64-x86-64
|
||||
|
||||
quadruple.mingw_x64 = x86_64-w64-mingw32
|
||||
targetSysRoot.mingw_x64 = msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1
|
||||
libffiDir.mingw_x64 = libffi-3.2.1-mingw-w64-x86-64
|
||||
# For using with Universal Windows Platform (UWP) we need to use this slower option.
|
||||
# See https://youtrack.jetbrains.com/issue/KT-27654.
|
||||
# TODO: remove, once fixed in mingw, check with the bug testcase.
|
||||
@@ -333,18 +322,21 @@ dependencies.mingw_x64 = \
|
||||
# WebAssembly 32-bit.
|
||||
targetToolchain.macos_x64-wasm32 = target-toolchain-3-macos-wasm
|
||||
dependencies.macos_x64-wasm32 = \
|
||||
libffi-3.2.1-3-darwin-macos \
|
||||
clang-llvm-6.0.1-darwin-macos \
|
||||
target-sysroot-2-wasm \
|
||||
target-toolchain-3-macos-wasm
|
||||
|
||||
targetToolchain.linux_x64-wasm32 = target-toolchain-2-linux-wasm
|
||||
dependencies.linux_x64-wasm32 = \
|
||||
libffi-3.2.1-2-linux-x86-64 \
|
||||
clang-llvm-6.0.1-linux-x86-64 \
|
||||
target-sysroot-2-wasm \
|
||||
target-toolchain-2-linux-wasm
|
||||
|
||||
targetToolchain.mingw_x64-wasm32 = target-toolchain-2-mingw-wasm
|
||||
dependencies.mingw_x64-wasm32 = \
|
||||
libffi-3.2.1-mingw-w64-x86-64 \
|
||||
msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1 \
|
||||
target-sysroot-2-wasm \
|
||||
target-toolchain-2-mingw-wasm
|
||||
|
||||
@@ -25,6 +25,7 @@ boardSpecificClangFlags.zephyr_stm32f4_disco = -mabi=aapcs -mthumb -mcpu=cortex-
|
||||
|
||||
targetToolchain.linux_x64-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-linux/arm-none-eabi
|
||||
dependencies.linux_x64-zephyr_stm32f4_disco = \
|
||||
libffi-3.2.1-2-linux-x86-64 \
|
||||
clang-llvm-6.0.1-linux-x86-64 \
|
||||
gcc-arm-none-eabi-7-2017-q4-major-linux \
|
||||
target-sysroot-2-wasm
|
||||
@@ -32,11 +33,13 @@ dependencies.linux_x64-zephyr_stm32f4_disco = \
|
||||
targetToolchain.macos_x64-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-mac/arm-none-eabi
|
||||
dependencies.macos_x64-zephyr_stm32f4_disco = \
|
||||
gcc-arm-none-eabi-7-2017-q4-major-mac \
|
||||
libffi-3.2.1-3-darwin-macos \
|
||||
clang-llvm-6.0.1-darwin-macos \
|
||||
target-sysroot-2-wasm
|
||||
|
||||
targetToolchain.mingw_x64-zephyr_stm32f4_disco = gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi
|
||||
dependencies.mingw_x64-zephyr_stm32f4_disco = \
|
||||
libffi-3.2.1-mingw-w64-x86-64 \
|
||||
msys2-mingw-w64-x86_64-gcc-7.3.0-clang-llvm-lld-6.0.1 \
|
||||
gcc-arm-none-eabi-7-2017-q4-major-win32 \
|
||||
target-sysroot-2-wasm
|
||||
|
||||
Reference in New Issue
Block a user