linux run test fix (except RTTI linking problems)
This commit is contained in:
@@ -40,9 +40,14 @@ abstract class KonanTest extends DefaultTask {
|
|||||||
"-headers", project.project(':runtime').file('src/main/kotlin'),
|
"-headers", project.project(':runtime').file('src/main/kotlin'),
|
||||||
"${sourceKt.absolutePath}"
|
"${sourceKt.absolutePath}"
|
||||||
|
|
||||||
|
<<<<<<< Updated upstream
|
||||||
String libraryPath = "${project.llvmDir}/lib:${backendNative.buildDir.canonicalPath}/nativelibs"
|
String libraryPath = "${project.llvmDir}/lib:${backendNative.buildDir.canonicalPath}/nativelibs"
|
||||||
environment 'LD_LIBRARY_PATH' : libraryPath
|
environment 'LD_LIBRARY_PATH' : libraryPath
|
||||||
environment 'DYLD_LIBRARY_PATH' : libraryPath
|
environment 'DYLD_LIBRARY_PATH' : libraryPath
|
||||||
|
=======
|
||||||
|
jvmArgs "-Djava.library.path=${backendNative.buildDir.canonicalPath}/nativelibs"
|
||||||
|
environment LD_LIBRARY_PATH : "${project.parent.llvmDir}/lib"
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
return sourceBc
|
return sourceBc
|
||||||
}
|
}
|
||||||
@@ -83,13 +88,26 @@ abstract class KonanTest extends DefaultTask {
|
|||||||
private String llvmTool(String tool) {
|
private String llvmTool(String tool) {
|
||||||
return "${project.llvmDir}/bin/${tool}"
|
return "${project.llvmDir}/bin/${tool}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private linux() {
|
||||||
|
return System.properties['os.name'].startsWith('Linux')
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String linkDl() {
|
||||||
|
if (linux()) {
|
||||||
|
return "-ldl"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnitKonanTest extends KonanTest {
|
class UnitKonanTest extends KonanTest {
|
||||||
void compileTest(File sourceS, File runtimeS, File exe) {
|
void compileTest(File sourceS, File runtimeS, File exe) {
|
||||||
def testC = sourceS.absolutePath.replace(".kt.S", "-test.c")
|
def testC = sourceS.absolutePath.replace(".kt.S", "-test.c")
|
||||||
project.exec {
|
project.exec {
|
||||||
commandLine "${llvmC}", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}",
|
commandLine "${llvmC}", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", linkDl(),
|
||||||
"-o", "${exe.absolutePath}"
|
"-o", "${exe.absolutePath}"
|
||||||
|
|
||||||
args llvmCAdditionalArgs
|
args llvmCAdditionalArgs
|
||||||
@@ -100,7 +118,7 @@ class UnitKonanTest extends KonanTest {
|
|||||||
class RunKonanTest extends KonanTest {
|
class RunKonanTest extends KonanTest {
|
||||||
void compileTest(File sourceS, File runtimeS, File exe) {
|
void compileTest(File sourceS, File runtimeS, File exe) {
|
||||||
project.exec {
|
project.exec {
|
||||||
commandLine "${llvmC}", "-DRUN_TEST", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}",
|
commandLine "${llvmC}", "-DRUN_TEST", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", linkDl(),
|
||||||
"-o", "${exe.absolutePath}"
|
"-o", "${exe.absolutePath}"
|
||||||
|
|
||||||
args llvmCAdditionalArgs
|
args llvmCAdditionalArgs
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#ifdef __linux__
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -10,7 +13,7 @@ extern int run_test();
|
|||||||
|
|
||||||
void * resolve_symbol(char *name) {
|
void * resolve_symbol(char *name) {
|
||||||
/* here we can add here some magic to resolve symbols in kotlin native*/
|
/* here we can add here some magic to resolve symbols in kotlin native*/
|
||||||
return dlsym(RTLD_SELF, name);
|
return dlsym(RTLD_DEFAULT, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user