Here goes stdlib separation.

$ gradlew backend.native:stdlib

builds you stdlib.kt.bc now.

The test runs are taught to supply
-library stdlib.kt.bc to kotlin compiler for proper imports resolution,
and then later stdlib.kt.bc is provided to clang for the final link step.
This commit is contained in:
Alexander Gorshenev
2016-11-17 17:37:43 +03:00
committed by alexander-gorshenev
parent b0d10e45d8
commit 1d265bc50c
11 changed files with 294 additions and 62 deletions
@@ -0,0 +1,10 @@
extern void *resolve_symbol(const char*);
int
run_test() {
int (*intrinsic)(int) = resolve_symbol("kfun:intrinsic(Int)");
if (intrinsic(3) != 4) return 1;
return 0;
}
@@ -0,0 +1,11 @@
// This code fails to link when bultins are taken from the
// frontend generated module, instead of our library.
// Because the generated module doesn't see our name changing annotations,
// the function names are all wrong.
fun intrinsic(b: Int): Int {
var sum = 1
sum = sum + b
return sum
}